audiomotion-analyzer 4.5.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +4 -5
- package/package.json +5 -5
- package/src/audioMotion-analyzer.js +4 -5
- package/src/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1614,5 +1614,5 @@ And if you're feeling generous, maybe:
|
|
|
1614
1614
|
|
|
1615
1615
|
## License
|
|
1616
1616
|
|
|
1617
|
-
audioMotion-analyzer copyright (c) 2018-
|
|
1617
|
+
audioMotion-analyzer copyright (c) 2018-2025 [Henrique Avila Vianna](https://henriquevianna.com)<br>
|
|
1618
1618
|
Licensed under the [GNU Affero General Public License, version 3 or later](https://www.gnu.org/licenses/agpl.html).
|
package/dist/index.js
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
* audioMotion-analyzer
|
|
22
22
|
* High-resolution real-time graphic audio spectrum analyzer JS module
|
|
23
23
|
*
|
|
24
|
-
* @version 4.5.
|
|
24
|
+
* @version 4.5.2
|
|
25
25
|
* @author Henrique Avila Vianna <hvianna@gmail.com> <https://henriquevianna.com>
|
|
26
26
|
* @license AGPL-3.0-or-later
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
const VERSION = '4.5.
|
|
29
|
+
const VERSION = '4.5.2';
|
|
30
30
|
|
|
31
31
|
// internal constants
|
|
32
32
|
const PI = Math.PI,
|
|
@@ -369,8 +369,7 @@
|
|
|
369
369
|
|
|
370
370
|
// Resume audio context if in suspended state (browsers' autoplay policy)
|
|
371
371
|
const unlockContext = () => {
|
|
372
|
-
if (audioCtx.state == 'suspended') audioCtx.resume();
|
|
373
|
-
window.removeEventListener(EVENT_CLICK, unlockContext);
|
|
372
|
+
if (audioCtx.state == 'suspended') audioCtx.resume().then(() => window.removeEventListener(EVENT_CLICK, unlockContext));
|
|
374
373
|
};
|
|
375
374
|
window.addEventListener(EVENT_CLICK, unlockContext);
|
|
376
375
|
|
|
@@ -2115,7 +2114,7 @@
|
|
|
2115
2114
|
if (_fadePeaks && !showPeakLine) {
|
|
2116
2115
|
const initialAlpha = !isAlpha || isOutline && _lineWidth > 0 ? 1 : isAlpha ? bar.peak[channel] : fillAlpha;
|
|
2117
2116
|
bar.alpha[channel] = initialAlpha * (1 + bar.hold[channel] / fadeFrames); // hold is negative, so this is <= 1
|
|
2118
|
-
} else bar.peak[channel] += bar.hold[channel] * gravity / fpsSquared / nominalMaxHeight;
|
|
2117
|
+
} else bar.peak[channel] += bar.hold[channel] * gravity / fpsSquared / Math.abs(nominalMaxHeight);
|
|
2119
2118
|
// make sure the peak value is reset when using fadePeaks
|
|
2120
2119
|
if (bar.alpha[channel] <= 0) bar.peak[channel] = 0;
|
|
2121
2120
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "audiomotion-analyzer",
|
|
3
3
|
"description": "High-resolution real-time graphic audio spectrum analyzer JavaScript module with no dependencies.",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.2",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./src/audioMotion-analyzer.js",
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/hvianna/audioMotion-analyzer"
|
|
30
|
+
"url": "git+https://github.com/hvianna/audioMotion-analyzer.git"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"spectrum analyzer",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://audiomotion.dev",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@babel/cli": "^7.
|
|
47
|
-
"@babel/core": "^7.
|
|
48
|
-
"@babel/plugin-transform-modules-umd": "^7.
|
|
46
|
+
"@babel/cli": "^7.27.2",
|
|
47
|
+
"@babel/core": "^7.27.4",
|
|
48
|
+
"@babel/plugin-transform-modules-umd": "^7.27.1"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* audioMotion-analyzer
|
|
3
3
|
* High-resolution real-time graphic audio spectrum analyzer JS module
|
|
4
4
|
*
|
|
5
|
-
* @version 4.5.
|
|
5
|
+
* @version 4.5.2
|
|
6
6
|
* @author Henrique Avila Vianna <hvianna@gmail.com> <https://henriquevianna.com>
|
|
7
7
|
* @license AGPL-3.0-or-later
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const VERSION = '4.5.
|
|
10
|
+
const VERSION = '4.5.2';
|
|
11
11
|
|
|
12
12
|
// internal constants
|
|
13
13
|
const PI = Math.PI,
|
|
@@ -368,8 +368,7 @@ class AudioMotionAnalyzer {
|
|
|
368
368
|
// Resume audio context if in suspended state (browsers' autoplay policy)
|
|
369
369
|
const unlockContext = () => {
|
|
370
370
|
if ( audioCtx.state == 'suspended' )
|
|
371
|
-
audioCtx.resume();
|
|
372
|
-
window.removeEventListener( EVENT_CLICK, unlockContext );
|
|
371
|
+
audioCtx.resume().then( () => window.removeEventListener( EVENT_CLICK, unlockContext ) );
|
|
373
372
|
}
|
|
374
373
|
window.addEventListener( EVENT_CLICK, unlockContext );
|
|
375
374
|
|
|
@@ -2198,7 +2197,7 @@ class AudioMotionAnalyzer {
|
|
|
2198
2197
|
bar.alpha[ channel ] = initialAlpha * ( 1 + bar.hold[ channel ] / fadeFrames ); // hold is negative, so this is <= 1
|
|
2199
2198
|
}
|
|
2200
2199
|
else
|
|
2201
|
-
bar.peak[ channel ] += bar.hold[ channel ] * gravity / fpsSquared / nominalMaxHeight;
|
|
2200
|
+
bar.peak[ channel ] += bar.hold[ channel ] * gravity / fpsSquared / Math.abs( nominalMaxHeight );
|
|
2202
2201
|
// make sure the peak value is reset when using fadePeaks
|
|
2203
2202
|
if ( bar.alpha[ channel ] <= 0 )
|
|
2204
2203
|
bar.peak[ channel ] = 0;
|
package/src/index.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export type GradientColorStop = string | { pos?: number; color: string; level?:
|
|
|
108
108
|
export type WeightingFilter = "" | "A" | "B" | "C" | "D" | "468";
|
|
109
109
|
|
|
110
110
|
export interface GradientOptions {
|
|
111
|
-
bgColor
|
|
111
|
+
bgColor?: string;
|
|
112
112
|
dir?: "h";
|
|
113
113
|
colorStops: GradientColorStop[];
|
|
114
114
|
}
|