audiomotion-analyzer 4.5.1 → 4.5.3

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 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-2025 [Henrique Avila Vianna](https://henriquevianna.com)<br>
1617
+ audioMotion-analyzer copyright (c) 2018-2026 [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.1
24
+ * @version 4.5.3
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.1';
29
+ const VERSION = '4.5.3';
30
30
 
31
31
  // internal constants
32
32
  const PI = Math.PI,
@@ -2114,7 +2114,7 @@
2114
2114
  if (_fadePeaks && !showPeakLine) {
2115
2115
  const initialAlpha = !isAlpha || isOutline && _lineWidth > 0 ? 1 : isAlpha ? bar.peak[channel] : fillAlpha;
2116
2116
  bar.alpha[channel] = initialAlpha * (1 + bar.hold[channel] / fadeFrames); // hold is negative, so this is <= 1
2117
- } else bar.peak[channel] += bar.hold[channel] * gravity / fpsSquared / nominalMaxHeight;
2117
+ } else bar.peak[channel] += bar.hold[channel] * gravity / fpsSquared / Math.abs(nominalMaxHeight);
2118
2118
  // make sure the peak value is reset when using fadePeaks
2119
2119
  if (bar.alpha[channel] <= 0) bar.peak[channel] = 0;
2120
2120
  }
@@ -2295,7 +2295,9 @@
2295
2295
  if (showPeakLine) {
2296
2296
  _ctx[m](...(_radial ? radialXY(x, h) : [x, analyzerBottom - h]));
2297
2297
  if (_radial && _mirror && !isDualHorizontal) points.push([x, h]);
2298
- } else if (h > 0) radialPoly(x, h, 1, -2); // standard peaks (also does mirror)
2298
+ } else if (b.peak[channel] > 0)
2299
+ // note: `h` is negative in inner radial
2300
+ radialPoly(x, h, 1, -2); // standard peaks (also does mirror)
2299
2301
  });
2300
2302
  if (showPeakLine) {
2301
2303
  let p;
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.1",
4
+ "version": "4.5.3",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./src/audioMotion-analyzer.js",
7
7
  "types": "./src/index.d.ts",
@@ -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.1
5
+ * @version 4.5.3
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.1';
10
+ const VERSION = '4.5.3';
11
11
 
12
12
  // internal constants
13
13
  const PI = Math.PI,
@@ -2197,7 +2197,7 @@ class AudioMotionAnalyzer {
2197
2197
  bar.alpha[ channel ] = initialAlpha * ( 1 + bar.hold[ channel ] / fadeFrames ); // hold is negative, so this is <= 1
2198
2198
  }
2199
2199
  else
2200
- bar.peak[ channel ] += bar.hold[ channel ] * gravity / fpsSquared / nominalMaxHeight;
2200
+ bar.peak[ channel ] += bar.hold[ channel ] * gravity / fpsSquared / Math.abs( nominalMaxHeight );
2201
2201
  // make sure the peak value is reset when using fadePeaks
2202
2202
  if ( bar.alpha[ channel ] <= 0 )
2203
2203
  bar.peak[ channel ] = 0;
@@ -2406,7 +2406,7 @@ class AudioMotionAnalyzer {
2406
2406
  if ( _radial && _mirror && ! isDualHorizontal )
2407
2407
  points.push( [ x, h ] );
2408
2408
  }
2409
- else if ( h > 0 )
2409
+ else if ( b.peak[ channel ] > 0 ) // note: `h` is negative in inner radial
2410
2410
  radialPoly( x, h, 1, -2 ); // standard peaks (also does mirror)
2411
2411
  });
2412
2412
  if ( showPeakLine ) {