audiomotion-analyzer 5.0.0-alpha.1 → 5.0.0-beta.0

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
@@ -1,6 +1,6 @@
1
1
  ## About
2
2
 
3
- > **WARNING:** code in **alpha** stage is subject to major, drastic changes! **DO NOT USE THIS IN PRODUCTION!**
3
+ > **VERSION 5 IS IN BETA PHASE!** Features can still change or be removed without warning. **DO NOT USE THIS VERSION IN PRODUCTION!**<br>
4
4
 
5
5
  **audioMotion-analyzer** is a high-resolution real-time audio spectrum analyzer built upon **Web Audio** and **Canvas** JavaScript APIs.
6
6
 
@@ -32,17 +32,19 @@ What users are saying:
32
32
  + Logarithmic, linear and perceptual (Bark and Mel) frequency scales, with customizable range
33
33
  + Visualization of discrete FFT frequencies or up to 240 frequency bands (supports ANSI and equal-tempered octave bands)
34
34
  + Decibel and linear amplitude scales, with customizable sensitivity
35
- + Optional A, B, C, D and ITU-R 468 weighting filters
35
+ + Optional weighting filters (A, B, C and D-weighting, ITU-R 468, 3dB and 4.5dB per octave tilt)
36
36
  + Additional effects: LED bars, radial spectrum, variable opacity bars, mirroring and reflection
37
37
  + Choose from 5 built-in color themes or easily add your own!
38
38
  + Fullscreen support, ready for retina / HiDPI displays
39
39
  + Zero-dependency native ES6+ module (ESM), \~30kB minified
40
40
 
41
+ ?> Minimum browser requirements: Chrome 84, Firefox 75, Opera 70 or Safari 13.1.
42
+
41
43
  ## Online demos
42
44
 
43
- [![demo-animation](img/demo.webp)](https://audiomotion.dev/demo/alpha/)
45
+ [![demo-animation](img/demo.webp)](https://audiomotion.dev/demo/beta/)
44
46
 
45
- ?> https://audiomotion.dev/demo/alpha/
47
+ ?> https://audiomotion.dev/demo/beta/
46
48
 
47
49
  ## Live code examples
48
50
 
@@ -63,7 +65,7 @@ What users are saying:
63
65
  Install via npm:
64
66
 
65
67
  ```console
66
- npm i audiomotion-analyzer@alpha
68
+ npm i audiomotion-analyzer@beta
67
69
  ```
68
70
 
69
71
  Use ES6 import:
@@ -84,7 +86,7 @@ Load from jsDelivr CDN:
84
86
 
85
87
  ```html
86
88
  <script type="module">
87
- import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@alpha/+esm';
89
+ import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@beta/+esm';
88
90
  // your code here
89
91
  </script>
90
92
  ```
@@ -96,7 +98,7 @@ Or download the [latest version](https://github.com/hvianna/audioMotion-analyzer
96
98
  Load from jsDelivr CDN:
97
99
 
98
100
  ```html
99
- <script src="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@alpha"></script>
101
+ <script src="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@beta"></script>
100
102
  <script>
101
103
  // available as AudioMotionAnalyzer global
102
104
  </script>
@@ -141,37 +143,35 @@ property | type | default | notes
141
143
  --------------------------------------|-----------|---------|-------------------------------
142
144
  [`alphaBars`](#alphabars) | *string* | `"off"` |
143
145
  [`ansiBands`](#ansibands) | *boolean* | `false` |
144
- [`audioCtx`](#audioctx) | *AudioContext object* | *creates new object* | constructor only
146
+ [`audioCtx`](#audioctx) | *AudioContext* | *creates new object* | constructor only
145
147
  [`barSpace`](#barspace) | *number* | `0.1` |
146
- [`canvas`](#canvas) | *HTMLCanvasElement object* | *creates new object* | constructor only
148
+ [`canvas`](#canvas) | *HTMLCanvasElement* | *creates new object* | constructor only
147
149
  [`channelLayout`](#channellayout) | *string* | `"single"` |
148
150
  [`colorMode`](#colormode) | *string* | `"gradient"` |
149
151
  [`connectSpeakers`](#connectspeakers) | *boolean* | `true` | constructor only
150
152
  [`fftSize`](#fftsize) | *number* | `8192` |
151
153
  [`fillAlpha`](#fillalpha) | *number* | `0.5` |
152
154
  [`frequencyScale`](#frequencyscale) | *string* | `"log"` |
153
- [`fsElement`](#fselement) | *HTMLElement object* | [`canvas`](#canvas) | constructor only
155
+ [`fsElement`](#fselement) | *HTMLElement* | [`canvas`](#canvas) | constructor only
154
156
  [`height`](#height) | *number* or *undefined* | `undefined` |
155
157
  [`ledBars`](#ledbars) | *string* | `"off"` |
156
158
  [`linearAmplitude`](#linearamplitude) | *boolean* | `false` |
157
159
  [`linearBoost`](#linearboost) | *number* | `1` |
158
160
  [`lineWidth`](#linewidth) | *number* | `1` |
159
161
  [`loRes`](#lores) | *boolean* | `false` |
160
- [`maxDecibels`](#maxdecibels) | *number* | `-25` |
162
+ [`maxDecibels`](#maxdecibels) | *number* | `-30` |
161
163
  [`maxFPS`](#maxfps) | *number* | `0` |
162
164
  [`maxFreq`](#maxfreq) | *number* | `22000` |
163
- [`minDecibels`](#mindecibels) | *number* | `-85` |
165
+ [`minDecibels`](#mindecibels) | *number* | `-90` |
164
166
  [`minFreq`](#minfreq) | *number* | `20` |
165
167
  [`mirror`](#mirror) | *number* | `0` |
166
168
  [`mode`](#mode) | *string* | `"bars"` |
167
- [`noteLabels`](#notelabels) | *boolean* | `false` |
168
169
  [`onCanvasDraw`](#oncanvasdraw) | *function* or *undefined* | `undefined` |
169
170
  [`onCanvasResize`](#oncanvasresize) | *function* or *undefined* | `undefined` |
170
171
  [`outlineBars`](#outlinebars) | *boolean* | `false` |
171
172
  [`peakDecayTime`](#peakdecaytime) | *number* | `750` |
172
173
  [`peakHoldTime`](#peakholdtime) | *number* | `500` |
173
174
  [`peakLine`](#peakline) | *boolean* | `false` |
174
- [`peaks`](#peaks) | *string* | `"drop"` |
175
175
  [`radial`](#radial) | *number* | `0` |
176
176
  [`radius`](#radius) | *number* | `0.5` |
177
177
  [`reflexAlpha`](#reflexalpha) | *number* | `0.15` |
@@ -181,16 +181,17 @@ property | type | default | notes
181
181
  [`roundBars`](#roundbars) | *boolean* | `false` |
182
182
  [`showFPS`](#showfps) | *boolean* | `false` |
183
183
  [`showLedMask`](#showledmask) | *boolean* | `true` |
184
- [`showScaleX`](#showscalex) | *boolean* | `true` |
185
- [`showScaleY`](#showscaley) | *boolean* | `false` |
186
- [`smoothing`](#smoothing) | *number* | `0.5` |
187
- [`source`](#source) | *AudioNode* or *HTMLMediaElement object* | *none* | constructor only
184
+ [`showPeaks`](#showpeaks) | *string* | `"drop"` |
185
+ [`showScaleX`](#showscalex) | *string* | `"freqs"` |
186
+ [`showScaleY`](#showscaley) | *string* | `"off"` |
187
+ [`smoothing`](#smoothing) | *number* | `0.7` |
188
+ [`source`](#source) | *AudioNode*, *HTMLMediaElement* or *MediaStream* | *none* | constructor only
188
189
  [`spinSpeed`](#spinspeed) | *number* | `0` |
189
190
  [`spreadGradient`](#spreadgradient) | *boolean* | `false` |
190
191
  [`start`](#start) | *boolean* | `true` | constructor only
191
192
  [`useCanvas`](#usecanvas) | *boolean* | `true` |
192
193
  [`volume`](#volume) | *number* | `1` |
193
- [`weightingFilter`](#weightingFilter) | *string* | `""` |
194
+ [`weightingFilter`](#weightingFilter) | *string* | `"none"` |
194
195
  [`width`](#width) | *number* or *undefined* | `undefined` |
195
196
 
196
197
  ### Constructor-specific options
@@ -225,7 +226,7 @@ If not defined, a new Canvas will be created. After instantiation, you can obtai
225
226
 
226
227
  **Value:** a *boolean* value. The default value is `true`.
227
228
 
228
- Whether or not to connect the analyzer output to the speakers (technically, the *AudioContext* `destination` node).
229
+ Whether or not to connect the analyzer output to the speakers (technically, the *AudioContext* [`destination`](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/destination) node).
229
230
 
230
231
  Some scenarios where you may want to set this to `false`:
231
232
 
@@ -255,9 +256,9 @@ After instantiation, [`fsElement`](#fselement-read-only) is available as a read-
255
256
 
256
257
  #### `source`
257
258
 
258
- **Value:** an [*AudioNode*](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode) or [*HTMLMediaElement*](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) object.
259
+ **Value:** an [*AudioNode*](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode), [*HTMLMediaElement*](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) or [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream) object.
259
260
 
260
- If `source` is specified, connects an AudioNode or an `<audio>` or `<video>` HTML element to the analyzer.
261
+ If `source` is specified, connects the provided *AudioNode*, HTML media element (`<audio>` or `<video>` elements) or *MediaStream* object to the analyzer.
261
262
 
262
263
  At least one audio source is required for the analyzer to work. You can also connect audio sources after instantiation, using the [`connectInput()`](#connectinput) method.
263
264
 
@@ -306,6 +307,16 @@ import {
306
307
  FILTER_C,
307
308
  FILTER_D,
308
309
  FILTER_468,
310
+ FILTER_TILT3,
311
+ FILTER_TILT45,
312
+ LABELS_X_CUSTOM,
313
+ LABELS_X_FREQS,
314
+ LABELS_X_FREQS_CUSTOM,
315
+ LABELS_X_NOTES,
316
+ LABELS_X_OFF,
317
+ LABELS_Y_DB,
318
+ LABELS_Y_PERCENT,
319
+ LABELS_Y_OFF,
309
320
  LAYOUT_COMBINED,
310
321
  LAYOUT_HORIZONTAL,
311
322
  LAYOUT_SINGLE,
@@ -313,14 +324,17 @@ import {
313
324
  LEDS_MODERN,
314
325
  LEDS_OFF,
315
326
  LEDS_VINTAGE,
327
+ MIRROR_LEFT,
328
+ MIRROR_OFF,
329
+ MIRROR_RIGHT,
316
330
  MODE_BARS,
317
331
  MODE_GRAPH,
318
332
  PEAKS_DROP,
319
333
  PEAKS_FADE,
320
334
  PEAKS_OFF,
321
- RADIAL_INNER,
335
+ RADIAL_INWARD,
322
336
  RADIAL_OFF,
323
- RADIAL_OUTER,
337
+ RADIAL_OUTWARD,
324
338
  REASON_CREATE,
325
339
  REASON_FULLSCREENCHANGE,
326
340
  REASON_LORES,
@@ -344,7 +358,7 @@ import {
344
358
 
345
359
  Determines whether each bar's opacity is affected by its amplitude. Only effective in **Bars** [`mode`](#mode).
346
360
 
347
- value | [Constant](#constants) | Description
361
+ Value | [Constant](#constants) | Description
348
362
  ---------|------------------------|--------------
349
363
  `"off"` | `ALPHABARS_OFF` | Disables effect
350
364
  `"on"` | `ALPHABARS_ON` | Bars with higher amplitude are rendered more opaque while those with lower amplitude are mode transparent
@@ -362,7 +376,7 @@ For effect priority when combined with other settings, see [`isAlphaBars`](#isal
362
376
 
363
377
  Whether to use the ANSI/IEC preferred frequencies, instead of the musical scale, to compute the center and edge frequencies of [octave bands](#bandresolution).
364
378
 
365
- value | Reference | Octaves' center frequencies
379
+ Value | Reference | Octaves' center frequencies
366
380
  --------|-----------------|----------------------------
367
381
  `false` | [A 440 pitch standard](http://hyperphysics.phy-astr.gsu.edu/hbase/Music/et.html) (equal temperament scale) | ![scale-log-equal-temperament](img/scale-log-equal-temperament.png)
368
382
  `true` | [ANSI S1.11-2004 standard](https://archive.org/details/gov.law.ansi.s1.11.2004) (base-10 scale) | ![scale-log-ansi](img/scale-log-ansi.png)
@@ -371,8 +385,6 @@ Only effective when [`frequencyScale`](#frequencyScale) is set to `"log"` and [`
371
385
 
372
386
  When using the equal-tempered scale, the center frequency of each band is tuned to a standard musical note.
373
387
 
374
- See also [`noteLabels`](#notelabels).
375
-
376
388
  ### `audioCtx` *(read only)*
377
389
 
378
390
  The [*AudioContext*](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext) used by **audioMotion-analyzer** for audio processing.
@@ -411,7 +423,7 @@ How much of an octave should each analyzer band represent, or how many bands sho
411
423
  When [`frequencyScale`](#frequencyscale-string) is set to `"log"`, this setting defines which fraction of an octave is included in each bar.
412
424
  Otherwise, the frequency spectrum is divided into a fixed amount of bars, with the bandwidth of each bar varying according to the selected frequency scale.
413
425
 
414
- value | [Constant](#constants) | Description
426
+ Value | [Constant](#constants) | Description
415
427
  :----:|------------------------|-----------------
416
428
  `0` | `BANDS_FFT` | Discrete frequencies provided by the [FFT](https://en.wikipedia.org/wiki/Fast_Fourier_transform) computation
417
429
  `1` | `BANDS_OCTAVE_FULL` | Full octave bands or 10 bands
@@ -461,7 +473,7 @@ See also the [`canvas`](#canvas) constructor option.
461
473
 
462
474
  Defines the number and layout of analyzer channels.
463
475
 
464
- value | [Constant](#constants) | Description
476
+ Value | [Constant](#constants) | Description
465
477
  --------------------|------------------------|-----------------
466
478
  `"single"` | `LAYOUT_SINGLE` | Single channel analyzer, representing the combined output of both left and right channels.
467
479
  `"dual-combined"` | `LAYOUT_COMBINED` | Dual channel analyzer, both channels overlaid. Works best with semi-transparent **Graph** [`mode`](#mode) or [`outlineBars`](#outlinebars).
@@ -481,7 +493,7 @@ See also [`setTheme()`](#settheme) and [`spreadGradient`](#spreadgradient).
481
493
 
482
494
  Selects the desired mode for coloring the analyzer bars. This property has no effect in **Graph** [`mode`](#mode).
483
495
 
484
- value | [Constant](#constants) | Description | Preview ('prism' theme)
496
+ Value | [Constant](#constants) | Description | Preview ('prism' theme)
485
497
  --------------|------------------------|-------------|-------------------------
486
498
  `"gradient"` | `COLORMODE_GRADIENT` | Analyzer bars are painted with a gradient of the selected [`theme`](#theme-string)'s colors. This is the default behavior. | ![prism](img/gradient-prism.png)
487
499
  `"bar-index"` | `COLORMODE_INDEX` | Each analyzer bar is painted with a **single color** from the selected theme's colors, starting with the first color applied to the first bar, and so on, cycling through the available colors. | ![prism-bar-index](img/gradient-prism-bar-index.png)
@@ -543,14 +555,14 @@ Current frame rate.
543
555
 
544
556
  Scale used to represent frequencies in the horizontal axis.
545
557
 
546
- value | [Constant](#constants) | Description | Scale preview (10Hz - 24kHz range)
558
+ Value | [Constant](#constants) | Description | Scale preview (10Hz - 24kHz range)
547
559
  -----------|------------------------|-------------|-------------------------------------
548
560
  `"bark"` | `SCALE_BARK` | Bark scale | ![scale-bark](img/scale-bark.png)
549
561
  `"linear"` | `SCALE_LINEAR` | Linear scale | ![scale-linear](img/scale-linear.png)
550
562
  `"log"` | `SCALE_LOG` | Logarithmic scale | ![scale-log-ansi](img/scale-log-ansi.png)
551
563
  `"mel"` | `SCALE_MEL` | Mel scale | ![scale-mel](img/scale-mel.png)
552
564
 
553
- Logarithmic scale allows visualization of proper **octave bands** (see [`bandResolution`](#bandresolution)) and it's also recommended when using [`noteLabels`](#notelabels).
565
+ Logarithmic scale allows visualization of proper **octave bands** (see [`bandResolution`](#bandresolution)) and it's also recommended when using [`showScaleX`](#showscalex) set to `"notes"`.
554
566
 
555
567
  [*Bark*](https://en.wikipedia.org/wiki/Bark_scale) and [*Mel*](https://en.wikipedia.org/wiki/Mel_scale) are perceptual pitch scales, which may provide better visualization of mid-range frequencies, when compared to log or linear scales.
556
568
 
@@ -650,15 +662,15 @@ Returns `true` when round bars are effectively being displayed, i.e., [`roundBar
650
662
 
651
663
  Determines the appearance of the LED bars. Only effective in **Bars** [`mode`](#mode), when [`bandResolution`](#bandresolution) > `0` and [`radial`](#radial) set to `0`.
652
664
 
653
- value | [Constant](#constants) | Description | Preview
665
+ Value | [Constant](#constants) | Description | Preview
654
666
  ------------|------------------------|-------------|----------
655
667
  `"off"` | `LEDS_OFF` | Disables effect | ![leds-off](img/leds_off.png)
656
668
  `"modern"` | `LEDS_MODERN` | Gradient-colored LEDs when [`colorMode`](#colormode) is set to `"gradient"` | ![leds-modern](img/leds_modern.png)
657
669
  `"vintage"` | `LEDS_VINTAGE` | Single color LEDs, determined by the `level` property of each color - see [registerTheme()](#registertheme) | ![leds-vintage](img/leds_vintage.png)
658
670
 
659
- Please note that `"modern"` and `"vintage"` will have the same look when [`colorMode`](#colormode) is set to `"bar-level"` or `"bar-index"`, as each bar will be a single color anyway.
671
+ Please note that `"modern"` and `"vintage"` will have the same look when [`colorMode`](#colormode) is set to `"bar-level"` or `"bar-index"`, as each bar will be assigned a single color in both cases.
660
672
 
661
- ?> The height and spacing of LED elements can be customized via [`setLeds()`](#setleds) method.
673
+ ?> The appearance of the LED bars can be customized via [`setLedProps()`](#setledprops) method.
662
674
 
663
675
  For effect priority when combined with other settings, see [`isLedBars`](#isledbars-read-only).
664
676
 
@@ -715,7 +727,7 @@ This will prevent the canvas size from changing, when switching the low resoluti
715
727
 
716
728
  ### `maxDecibels`
717
729
 
718
- **Value:** a *number*. The default value is `-25`.
730
+ **Value:** a *number*. The default value is `-30`.
719
731
 
720
732
  Maximum amplitude value, in decibels, represented in the Y-axis of the analyzer.
721
733
 
@@ -732,9 +744,9 @@ See also [`minDecibels`](#mindecibels) and [`setSensitivity()`](#setsensitivity)
732
744
  Determines the maximum desired frame rate for the analyzer animation, in frames per second.
733
745
 
734
746
  A value of `0` means the animation will run at the highest frame rate possible, limited by the refresh rate of your display.
735
- For example, if you have a 144Hz monitor, the frame rate may reach up to 144 fps.
747
+ For example, if you have a 144Hz monitor, the frame rate may reach up to 144 FPS.
736
748
 
737
- Usually, 60 fps is enough for a smooth animation, so setting `maxFPS` to `60` may help reducing CPU usage on high refresh rate monitors.
749
+ Usually, 60 FPS is enough for a smooth animation, so setting `maxFPS` to `60` may help reducing CPU usage on monitors with higher refresh rates.
738
750
 
739
751
  ### `maxFreq`
740
752
 
@@ -749,7 +761,7 @@ See also [`minFreq`](#minfreq) and [`setFreqRange()`](#setfreqrange).
749
761
 
750
762
  ### `minDecibels`
751
763
 
752
- **Value:** a *number*. The default value is `-85`.
764
+ **Value:** a *number*. The default value is `-90`.
753
765
 
754
766
  Minimum amplitude value, in decibels, represented in the Y-axis of the analyzer.
755
767
 
@@ -775,11 +787,11 @@ When [`channelLayout`](#channellayout-string) is **dual-horizontal**, this prope
775
787
 
776
788
  For other layouts, it horizontally mirrors the spectrum image to the left or right side.
777
789
 
778
- value | Description
779
- :-----:|-------------
780
- `-1` | Low frequencies meet at the center of the screen (mirror left)
781
- `0` | No mirror effect or change to axis orientation (default)
782
- `1` | High frequencies meet at the center of the screen (mirror right)
790
+ Value | [Constant](#constants) | Description
791
+ :-----:|------------------------|---------------
792
+ `-1` | `MIRROR_LEFT` | Low frequencies meet at the center of the screen
793
+ `0` | `MIRROR_OFF` | No mirror effect or change to axis orientation (default)
794
+ `1` | `MIRROR_RIGHT` | High frequencies meet at the center of the screen
783
795
 
784
796
  **Note:** On [`radial`](#radial) spectrum with channel layouts other than *dual-horizontal*, both `1` and `-1` have the same effect.
785
797
 
@@ -789,7 +801,7 @@ value | Description
789
801
 
790
802
  Determines the visualization mode.
791
803
 
792
- value | [Constant](#constants) | Description
804
+ Value | [Constant](#constants) | Description
793
805
  ----------|------------------------|-----------------
794
806
  `"bars"` | `MODE_BARS` | displays bars for each frequency or frequency band
795
807
  `"graph"` | `MODE_GRAPH` | connects frequency/bands data points into continuous line with optional filled area graph
@@ -804,17 +816,6 @@ See also [`bandResolution`](#bandresolution).
804
816
  > 1 through 8 | "bars" | 9 *minus* legacy mode
805
817
  > 10 | "graph" | 0
806
818
 
807
- ### `noteLabels`
808
-
809
- *Available since v4.0.0*
810
-
811
- **Value:** a *boolean* value. The default value is `false`.
812
-
813
- Whether to displays musical note labels instead of frequency values, in the X-axis (when [`showScaleX`](#showscalex) is `true`).
814
-
815
- For best visualization in [octave bands modes](#mode), make sure [`frequencyScale`](#frequencyscale) is set to `"log"`
816
- and [`ansiBands`](#ansibands) is set to `false`, so bands are tuned to the equal temperament musical scale.
817
-
818
819
  ### `onCanvasDraw`
819
820
 
820
821
  **Value:** a *function* or *undefined*. The default value is `undefined`.
@@ -924,7 +925,7 @@ For effect priority when combined with other settings, see [`isOutlineBars`](#is
924
925
 
925
926
  **Value:** a *number*. The default value is `750`.
926
927
 
927
- Time in milliseconds for peaks to fall down from maximum amplitude to zero, or to completely fade out (when [`fadePeaks`](#fadepeaks) is `true`).
928
+ Time in milliseconds for peaks to fall down from maximum amplitude to zero, or to completely fade out (when [`showPeaks`](#showpeaks) is set to `"fade"`).
928
929
 
929
930
  It must be a number greater than or equal to zero. Invalid values are ignored.
930
931
 
@@ -940,7 +941,7 @@ Time in milliseconds for peaks to hold their value before they begin to fall or
940
941
 
941
942
  It must be a number greater than or equal to zero. Invalid values are ignored.
942
943
 
943
- See also [`fadePeaks`](#fadepeaks), [`peakDecayTime`](#peakdecaytime) and [`showPeaks`](#showpeaks).
944
+ See also [`peakDecayTime`](#peakdecaytime) and [`showPeaks`](#showpeaks).
944
945
 
945
946
  ### `peakLine`
946
947
 
@@ -952,23 +953,7 @@ Determines the line width used to connect the amplitude peaks, when [`mode`](#mo
952
953
 
953
954
  A value of `0` means no line.
954
955
 
955
- Please note that [`peaks`](#peaks) must be set to either `"drop"` or `"fade"`, although peak lines will always display the *"drop"* behavior.
956
-
957
- ### `peaks`
958
-
959
- *Available since v5.0.0; formerly `showPeaks` (since v1.0.0)*
960
-
961
- **Value:** a *string*. The default value is `"drop"`.
962
-
963
- Determines the display and behavior of amplitude peaks.
964
-
965
- value | [Constant](#constants) | Description
966
- ---------|------------------------|--------------
967
- `"off"` | `PEAKS_OFF` | Disable display of amplitude peaks (including [`peakLine`](#peakline))
968
- `"drop"` | `PEAKS_DROP` | Display peaks that fall down over time
969
- `"fade"` | `PEAKS_FADE` | Display peaks that fade out over time
970
-
971
- See also [`peakDecayTime`](#peakdecaytime) and [`peakHoldTime`](#peakholdtime).
956
+ Please note that [`showPeaks`](#showpeaks) must be set to either `"drop"` or `"fade"`, although peak lines will always display the *"drop"* behavior.
972
957
 
973
958
  ### `pixelRatio` *(read only)*
974
959
 
@@ -989,11 +974,11 @@ You can refer to this value to adjust any additional drawings done in the canvas
989
974
 
990
975
  Whether to render the spectrum analyzer as a circle with radial bars.
991
976
 
992
- value | [Constant](#constants) | Description
977
+ Value | [Constant](#constants) | Description
993
978
  ------|------------------------|----------------
994
- `0` | `RADIAL_OFF` | Disables radial
995
- `1` | `RADIAL_OUTER` | Bars grow towards the edges of the screen
996
- `-1` | `RADIAL_INNER` | Bars grow towards the center of the screen
979
+ `0` | `RADIAL_OFF` | Disables radial
980
+ `1` | `RADIAL_OUTWARD` | Bars grow towards the edges of the screen
981
+ `-1` | `RADIAL_INWARD` | Bars grow towards the center of the screen
997
982
 
998
983
  When [`channelLayout`](#channellayout) is set to `"dual-vertical"`, left channel bars grow outwards and right channel bars grow inwards, so both `1` and `-1` values have the same effect.
999
984
 
@@ -1092,38 +1077,65 @@ Whether to display the "unlit" LED elements. Has no effect when [`ledBars`](#led
1092
1077
  :----------------------:|:-----------------------:
1093
1078
  ![ledmask-off](img/ledmask_off.png) | ![ledmask-on](img/ledmask_on.png)
1094
1079
 
1080
+ ?> The appearance of the LED mask can be customized via [`setLedProps()`](#setledprops).
1081
+
1082
+ ### `showPeaks`
1083
+
1084
+ **Value:** a *string*. The default value is `"drop"`.
1085
+
1086
+ Determines the display and behavior of amplitude peaks.
1087
+
1088
+ Value | [Constant](#constants) | Description
1089
+ ---------|------------------------|--------------
1090
+ `"off"` | `PEAKS_OFF` | Disable display of amplitude peaks and [`peakLine`](#peakline)
1091
+ `"drop"` | `PEAKS_DROP` | Display peaks that fall down over time
1092
+ `"fade"` | `PEAKS_FADE` | Display peaks that fade out over time
1093
+
1094
+ See also [`peakDecayTime`](#peakdecaytime) and [`peakHoldTime`](#peakholdtime).
1095
+
1095
1096
  ### `showScaleX`
1096
1097
 
1097
1098
  *Available since v3.0.0; formerly `showScale` (since v1.0.0)*
1098
1099
 
1099
- **Value:** a *boolean* value. The default value is `true`.
1100
+ **Value:** a *string*. The default value is `"freqs"`.
1100
1101
 
1101
1102
  Whether to display scale labels on the X-axis.
1102
1103
 
1103
- Several properties of the scale can be customized via [`setXAxis()`](#setxaxis) method.
1104
+ Value | [Constant](#constants) | Description
1105
+ -----------------|-------------------------|---------------
1106
+ `"off"` | `LABELS_X_OFF` | Do not display scale labels on the X-axis.
1107
+ `"custom"` | `LABELS_X_CUSTOM` | Display custom `labels` defined via [`setScaleProps()`](#setscaleprops).
1108
+ `"freqs"` | `LABELS_X_FREQS` | Display octaves center frequencies - see also [`ansiBands`](#ansibands).
1109
+ `"freqs+custom"` | `LABELS_X_FREQS_CUSTOM` | Display center frequencies and any additional custom labels.
1110
+ `"notes"` | `LABELS_X_NOTES` | Display musical note labels.
1111
+
1112
+ Several display properties of the scale can be customized via [`setScaleProps()`](#setscaleprops) method.
1104
1113
 
1105
- See also [`noteLabels`](#notelabels).
1114
+ ?> For best results of `"notes"` setting in [octave bands modes](#bandresolution), make sure [`frequencyScale`](#frequencyscale) is set to `"log"` and [`ansiBands`](#ansibands) is set to `false`, so bands are tuned to the equal temperament musical scale.
1106
1115
 
1107
1116
  ### `showScaleY`
1108
1117
 
1109
1118
  *Available since v2.4.0*
1110
1119
 
1111
- **Value:** a *boolean* value. The default value is `false`.
1120
+ **Value:** a *string*. The default value is `"off"`.
1112
1121
 
1113
1122
  Whether to display the level/amplitude scale on the Y-axis.
1114
1123
 
1115
- This option has no effect when [`radial`](#radial) is active or [`alphaBars`](#alphabars) is set to `"full"`.
1124
+ Value | [Constant](#constants) | Description
1125
+ ------------|------------------------|---------------
1126
+ `"off"` | `LABELS_Y_OFF` | Do not display scale labels on the Y-axis.
1127
+ `"db"` | `LABELS_Y_DB` | Display labels in decibels.
1128
+ `"percent"` | `LABELS_Y_PERCENT` | Display labels in percent values.
1116
1129
 
1117
- When [`linearAmplitude`](#linearamplitude) is set to *false* (default), labels are shown in decibels (dB);
1118
- otherwise, values represent a percentage (0-100%) of the maximum amplitude.
1130
+ This option has no effect when [`radial`](#radial) is active or [`alphaBars`](#alphabars) is set to `"full"`.
1119
1131
 
1120
- Several properties of the scale can be customized via [`setYAxis()`](#setyaxis) method.
1132
+ Several display properties of the scale can be customized via [`setScaleProps()`](#setscaleprops) method.
1121
1133
 
1122
1134
  See also [`minDecibels`](#mindecibels) and [`maxDecibels`](#maxdecibels).
1123
1135
 
1124
1136
  ### `smoothing`
1125
1137
 
1126
- **Value:** a *number*. The default value is `0.5`.
1138
+ **Value:** a *number*. The default value is `0.7`.
1127
1139
 
1128
1140
  Determines the analyzer's [smoothingTimeConstant](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/smoothingTimeConstant).
1129
1141
 
@@ -1188,27 +1200,28 @@ Please note that changing the volume on the audio element will affect the amplit
1188
1200
 
1189
1201
  *Available since v4.0.0*
1190
1202
 
1191
- [Weighting filter](https://en.wikipedia.org/wiki/Weighting_filter) applied to analyzer data, for spectrum visualization only.
1192
-
1193
- <img src="img/weigthing-filters-curves.png" class="align-right">
1203
+ [Weighting filter](https://en.wikipedia.org/wiki/Weighting_filter) applied to analyzer data, for spectrum visualization.
1204
+ Each filter applies a different curve of gain/attenuation to specific frequency ranges, but the general idea is to adjust the
1205
+ visualization of frequencies to the sensitivity of the human ear.
1194
1206
 
1195
- **Value:** a *string*. The default value is `""`.
1207
+ **Value:** a *string*. The default value is `"none"`.
1196
1208
 
1197
- Value | [Constant](#constants) | Description
1198
- --------|------------------------|---------------
1199
- `""` | `FILTER_NONE` | No weighting applied (default)
1200
- `"A"` | `FILTER_A` | A-weighting
1201
- `"B"` | `FILTER_B` | B-weighting
1202
- `"C"` | `FILTER_C` | C-weighting
1203
- `"D"` | `FILTER_D` | D-weighting
1204
- `"468"` | `FILTER_468` | ITU-R 468 weighting
1209
+ <img src="img/weigthing-filters-curves.png" class="align-right">
1205
1210
 
1206
- ?> Weighting filters only affect the visualization, **NOT** the audio output.
1211
+ Value | [Constant](#constants) | Description
1212
+ ------------|------------------------|---------------
1213
+ `"none"` | `FILTER_NONE` | No weighting applied (default)
1214
+ `"a"` | `FILTER_A` | A-weighting
1215
+ `"b"` | `FILTER_B` | B-weighting
1216
+ `"c"` | `FILTER_C` | C-weighting
1217
+ `"d"` | `FILTER_D` | D-weighting
1218
+ `"468"` | `FILTER_468` | ITU-R 468 weighting
1219
+ `"tilt3"` | `FILTER_TILT3` | 3dB per octave tilt
1220
+ `"tilt4.5"` | `FILTER_TILT45` | 4.5dB per octave tilt
1207
1221
 
1208
- Each filter applies a different curve of gain/attenuation to specific frequency ranges, but the general idea is to adjust the
1209
- visualization of frequencies to the sensitivity of the human ear.
1222
+ ?> Refer to the [**weighting filters viewer tool**](/tools/weighting-filters.html) for filter response tables and an interactive version of the graph seen above.
1210
1223
 
1211
- Refer to the [weighting filters viewer tool](/tools/weighting-filters.html) for response tables and an interactive version of the curves graph seen below.
1224
+ !> Weighting filters only affect the spectrum visualization, **NOT** the audio output.
1212
1225
 
1213
1226
  ### `width`
1214
1227
 
@@ -1232,77 +1245,121 @@ Since this is a static property, you should always access it as `AudioMotionAnal
1232
1245
 
1233
1246
  ## Methods
1234
1247
 
1235
- ### `connectInput( source )`
1248
+ ### `connectInput()`
1236
1249
 
1237
1250
  *Available since v3.0.0*
1238
1251
 
1239
- Connects an [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) or an [AudioNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode)
1240
- (or any of its descendants) to the analyzer.
1252
+ Connects an audio source to the analyzer.
1253
+
1254
+ **Syntax:**
1255
+
1256
+ ```js
1257
+ connectInput(source)
1258
+ ```
1259
+
1260
+ Parameter | type | description
1261
+ ----------|------|---------------
1262
+ `source` | *object* | an [AudioNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode) (or any of its descendants), [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) or [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream) object
1263
+
1264
+ When `source` is an *HTMLMediaElement* or *MediaStream*, a [MediaElementAudioSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/MediaElementAudioSourceNode)
1265
+ or [MediaStreamAudioSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamAudioSourceNode) object will be created, respectivelly.
1266
+
1267
+ If `source` is not a valid object, an [`ERR_INVALID_AUDIO_SOURCE`](#custom-errors) error is thrown.
1241
1268
 
1242
- If `source` is an *HTMLMediaElement*, the method returns a [MediaElementAudioSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/MediaElementAudioSourceNode) created
1243
- for that element; if `source` is an *AudioNode* instance, it returns the `source` object itself; if it's neither an [ERR_INVALID_AUDIO_SOURCE](#custom-errors) error is thrown.
1269
+ **Return value:** an *AudioNode* object, representing the actual audio node connected.
1244
1270
 
1245
- See also [`disconnectInput()`](#disconnectinput-node-stoptracks-) and [`connectedSources`](#connectedsources-array-read-only).
1271
+ See also [`disconnectInput()`](#disconnectinput) and [`connectedSources`](#connectedsources-read-only).
1246
1272
 
1247
- ### `connectOutput( [node] )`
1273
+ ### `connectOutput()`
1248
1274
 
1249
1275
  *Available since v3.0.0*
1250
1276
 
1251
1277
  This method allows connecting the analyzer **output** to other audio processing modules that use the Web Audio API.
1252
1278
 
1253
- `node` must be an [*AudioNode*](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode) instance.
1279
+ **Syntax:**
1254
1280
 
1255
- By default, the analyzer is connected to the speakers upon instantiation, unless you set [`connectSpeakers: false`](#connectspeakers) in the constructor options.
1281
+ ```js
1282
+ connectOutput()
1283
+ connectOutput(node)
1284
+ ```
1256
1285
 
1257
- See also [`disconnectOutput()`](#disconnectoutput-node-) and [`connectedTo`](#connectedto-array-read-only).
1286
+ Parameter | type | description
1287
+ ----------|------|---------------
1288
+ `node` | [*AudioNode*](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode) | If not specified, output is connected to the speakers (the *AudioContext* `destination` node).
1258
1289
 
1259
- ?> If called with no argument, analyzer output is connected to the speakers (the *AudioContext* `destination` node).
1290
+ By default, the analyzer is already connected to the speakers upon instantiation, unless you set [`connectSpeakers: false`](#connectspeakers) in the constructor options.
1291
+
1292
+ **Return value:** none (`undefined`).
1293
+
1294
+ See also [`disconnectOutput()`](#disconnectoutput) and [`connectedTo`](#connectedto-read-only).
1260
1295
 
1261
1296
  ### `destroy()`
1262
1297
 
1263
1298
  *Available since v4.2.0*
1264
1299
 
1265
- Destroys the **audioMotion-analyzer** instance and release resources. A destroyed analyzer cannot be started again.
1300
+ Destroys the **audioMotion-analyzer** instance and releases resources. A destroyed analyzer cannot be started again.
1301
+
1302
+ **Syntax:**
1303
+
1304
+ ```js
1305
+ destroy()
1306
+ ```
1266
1307
 
1267
1308
  This method:
1268
1309
 
1269
1310
  + Stops the analyzer data processing and animation;
1270
1311
  + Disconnects all input and output nodes;
1271
1312
  + Clears event listeners and callback functions;
1272
- + Stops the *AudioContext* created by this instance (won't affect context provided to the [constructor](#constructor) via [`audioCtx`](#audioctx-audiocontext-object) property or an *AudioNode* [`source`](#source-htmlmediaelement-or-audionode-object));
1313
+ + Stops the *AudioContext* created by this instance (won't affect context provided to the [constructor](#constructor) via [`audioCtx`](#audioctx) property or an *AudioNode* [`source`](#source));
1273
1314
  + Removes the [`canvas`](#canvas-htmlcanvaselement-object-read-only) from the DOM.
1274
1315
 
1275
1316
  See usage example in the [minimal demo](/demo/minimal.html).
1276
1317
 
1318
+ **Return value:** none (`undefined`).
1319
+
1277
1320
  See also [`isDestroyed`](#isdestroyed-read-only).
1278
1321
 
1279
- ### `disconnectInput( [node], [stopTracks] )`
1322
+ ### `disconnectInput()`
1280
1323
 
1281
1324
  *Available since v3.0.0; `stopTracks` parameter since v4.2.0*
1282
1325
 
1283
1326
  Disconnects audio source nodes previously connected to the analyzer.
1284
1327
 
1285
- `node` may be an *AudioNode* instance or an **array** of such objects. If it's **undefined** (or any [*falsy*](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) value),
1286
- **all connected sources are disconnected.**
1328
+ **Syntax:**
1329
+
1330
+ ```js
1331
+ disconnectInput()
1332
+ disconnectInput(sources)
1333
+ disconnectInput(sources, stopTracks)
1334
+ ```
1287
1335
 
1288
- `stopTracks` is a boolean value; if **true**, permanently stops all audio tracks from any [*MediaStream*](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream)s being
1289
- disconnected, e.g. a microphone. Use it to effectively release the stream if it's no longer needed.
1336
+ Parameter | type | description
1337
+ -------------|------|---------------
1338
+ `sources` | *object* or *array* | a previously connected [AudioNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode), [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) or [MediaStream](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream), or an array of such objects. **When [*falsy*](https://developer.mozilla.org/en-US/docs/Glossary/Falsy), all connected sources are disconnected.**
1339
+ `stopTracks` | *boolean* | if `true`, permanently stops all audio tracks from any [*MediaStream*](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream)s being disconnected.
1290
1340
 
1291
- Please note that when you have connected an `<audio>` or `<video>` element, you need to disconnect the respective [MediaElementAudioSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/MediaElementAudioSourceNode)
1292
- created for it. The node reference is returned by [`connectInput()`](#connectinput-source-), or can be obtained from [`connectedSources`](#connectedsources-array-read-only)
1293
- if the element was connected via [`source`](#source-htmlmediaelement-or-audionode-object) constructor option.
1341
+ **Return value:** none (`undefined`).
1294
1342
 
1295
- ### `disconnectOutput( [node] )`
1343
+ ### `disconnectOutput()`
1296
1344
 
1297
1345
  *Available since v3.0.0*
1298
1346
 
1299
1347
  Disconnects the analyzer output from previously connected audio nodes.
1300
1348
 
1301
- `node` must be a connected *AudioNode*.
1349
+ **Syntax:**
1302
1350
 
1303
- See also [`connectOutput()`](#connectoutput-node-).
1351
+ ```js
1352
+ disconnectOutput()
1353
+ disconnectOutput(node)
1354
+ ```
1304
1355
 
1305
- ?> If called with no argument, analyzer output is disconnected from all nodes, **including the speakers!**
1356
+ Parameter | type | description
1357
+ ----------|------|---------------
1358
+ `node` | *AudioNode* | must be a connected *AudioNode*. If not specified, analyzer output is disconnected from all nodes, **including the speakers!**
1359
+
1360
+ **Return value:** none (`undefined`).
1361
+
1362
+ See also [`connectOutput()`](#connectoutput).
1306
1363
 
1307
1364
  ### `getBars()`
1308
1365
 
@@ -1325,7 +1382,7 @@ Returns an array with current data for each analyzer bar. Each array element is
1325
1382
  `peak` and `value` elements are floats between 0 and 1, relative to the lowest and highest volume levels defined by [`minDecibels`](#mindecibels) and [`maxDecibels`](#maxdecibels).
1326
1383
 
1327
1384
  `hold` values are integers and indicate the hold time (in frames) for the current peak.
1328
- Negative values mean the peak is currently fading or falling down, depending on the value of [`fadePeaks`](#fadepeaks).
1385
+ Negative values mean the peak is currently falling down or fading out.
1329
1386
 
1330
1387
  Please note that `hold` and `value` will have only one element when [`channelLayout`](#channellayout-string) is set to *'single'*, but `peak` is always a two-element array.
1331
1388
 
@@ -1370,6 +1427,14 @@ Use this method inside your callback function to create additional visual effect
1370
1427
 
1371
1428
  **Return value:** a *number* between `0.0` and `1.0`, or `null` if preset name is invalid.
1372
1429
 
1430
+ ### `getLedProps()`
1431
+
1432
+ *Available since v5.0.0*
1433
+
1434
+ Retrieves the current properties used to create the [`ledBars`](#ledbars) effect.
1435
+
1436
+ **Return value:** an *object*. Refer to [`setLedProps()`](#setledprops) for available properties.
1437
+
1373
1438
  ### `getOptions()`
1374
1439
 
1375
1440
  *Available since v4.4.0*
@@ -1393,28 +1458,46 @@ Callbacks and [constructor-specific properties](#constructor-specific-options) a
1393
1458
 
1394
1459
  See also [`setOptions()`](#setoptions).
1395
1460
 
1461
+ ### `getScaleProps()`
1462
+
1463
+ *Available since v5.0.0*
1464
+
1465
+ Retrieves the current scale display properties on both axes.
1466
+
1467
+ **Syntax:**
1468
+
1469
+ ```js
1470
+ getScaleProps()
1471
+ ```
1472
+
1473
+ **Return value:** an *object* - see [`setScaleProps()`](#setscaleprops) for object structure.
1474
+
1396
1475
  ### `getTheme()`
1397
1476
 
1398
1477
  *Available since v5.0.0*
1399
1478
 
1400
- Returns the name of the theme set for the given channel.
1479
+ Retrieves the active theme name and, optionally, the state of theme modifiers for one or both analyzer channels.
1401
1480
 
1402
1481
  **Syntax:**
1403
1482
 
1404
1483
  ```js
1405
- getTheme()
1406
- getTheme(channel, includeModifiers)
1407
- getTheme(includeModifiers)
1484
+ getTheme() // returns theme names for both channels (array of strings)
1485
+ getTheme(includeModifiers) // returns theme and modifiers for both channels (array of objects)
1486
+ getTheme(channel) // returns theme name for given channel (string)
1487
+ getTheme(channel, includeModifiers) // returns theme and modifiers for given channel (object)
1408
1488
  ```
1409
1489
 
1410
1490
  Parameter | type | description
1411
1491
  ----------|------|-----------------
1412
- `channel` | *number* | *(optional)* channel to set (`0` = left, `1` = right) - if not specified, considers channel 0
1413
- `includeModifiers` | *boolean* | *(optional)* `true` to also return the state of theme modifiers
1492
+ `channel` | *number* | Channel index (`0` = left, `1` = right). If omitted or invalid, returns data for both channels in an array.
1493
+ `includeModifiers` | *boolean* | If `true`, includes the state of theme modifiers (returns an object).
1414
1494
 
1415
- **Return value:** a *string* representing the theme name, or an *object* with `name` and `modifiers` properties.
1495
+ **Return value:**
1496
+ - *string* → theme name (single channel, no modifiers)
1497
+ - *object* → `{ name, modifiers }` (single channel with modifiers)
1498
+ - *array* → of strings or objects (both channels)
1416
1499
 
1417
- See also [`setTheme()`](#settheme).
1500
+ See also [`getThemeModifiers()`](#getthememodifiers) and [`setTheme()`](#settheme).
1418
1501
 
1419
1502
  ### `getThemeData()`
1420
1503
 
@@ -1432,7 +1515,7 @@ getThemeData(name)
1432
1515
 
1433
1516
  **Return value:** an *object* (structure below) or `null` if theme name is invalid.
1434
1517
 
1435
- property | type | description
1518
+ Property | type | description
1436
1519
  ---------|------|---------------
1437
1520
  `colorStops` | *array* | all entries are normalized as objects with `color`, `level` and `pos` properties
1438
1521
  `peakColor` | *string* | `undefined` if not originally defined in [theme registration](#registertheme)
@@ -1462,6 +1545,27 @@ Returns the names of available themes, including built-in and custom registered
1462
1545
 
1463
1546
  **Return value:** an *array* of *string*s.
1464
1547
 
1548
+ ### `getThemeModifiers()`
1549
+
1550
+ *Available since v5.0.0*
1551
+
1552
+ Returns the state of theme modifiers for the given channel.
1553
+
1554
+ **Syntax:**
1555
+
1556
+ ```js
1557
+ getThemeModifiers()
1558
+ getThemeModifiers(channel)
1559
+ ```
1560
+
1561
+ Parameter | type | description
1562
+ -----------|----------|-----------------
1563
+ `channel` | *number* | Channel index (`0` = left, `1` = right) - **if omitted, considers channel 0**
1564
+
1565
+ **Return value:** an *object* - see [`setThemeModifiers()`](#setthememodifiers) for object structure.
1566
+
1567
+ See also [`getTheme()`](#gettheme).
1568
+
1465
1569
  ### `registerTheme()`
1466
1570
 
1467
1571
  *Available since v5.0.0; formerly `registerGradient()` (since v1.0.0)*
@@ -1474,21 +1578,21 @@ Registers a custom color theme.
1474
1578
  registerTheme(name, options)
1475
1579
  ```
1476
1580
 
1477
- parameter | type | description
1581
+ Parameter | type | description
1478
1582
  ----------|------|-------------
1479
1583
  `name` | *string* | Names are **case sensitive** and will be used to select the theme via [`setTheme()`](#settheme) method.
1480
1584
  `options` | *object* | Contains the color information (see below).
1481
1585
 
1482
1586
  **`options` object structure:**
1483
1587
 
1484
- property | type | description
1588
+ Property | type | description
1485
1589
  -------------|--------|-------------
1486
1590
  `colorStops` | *array* | **At least one array element is required.** Each one must be either a *string* (color in CSS format), or an *object* (see below).
1487
1591
  `peakColor` | *string* | Optional; if defined, **all peaks** will be painted this color, regardless of their levels.
1488
1592
 
1489
- **`colorStops` color object structure:**
1593
+ **`colorStops` entry object structure:**
1490
1594
 
1491
- property | type | description
1595
+ Property | type | description
1492
1596
  ---------|--------|-------------
1493
1597
  `color` | *string* | Any valid CSS color format, e.g. 'red', '#f00', 'rgb(…)', 'hsl(…)', etc.
1494
1598
  `level` | *number* | Optional; sets the **upper level** threshold for applying this color to a bar (when [`colorMode`](#colormode-string) is set to `"bar-level"`) or LED segment (when [`ledBars`](#ledbars) is set to `"vintage"`). It must be a number between `0` and `1`, where `1` is the maximum amplitude (top of screen).
@@ -1539,10 +1643,28 @@ Theme | [`ledBars`](#ledbars) = `"off"` | [`ledBars`](#ledbars) = `"vintage"` |
1539
1643
  **bluey-B**<br>(custom `pos` / custom `level`) | ![bluey-b-gradient](img/levels-bluey-b-gradient.png) | ![bluey-b-trueleds](img/levels-bluey-b-trueleds.png) | ![bluey-b-barlevel](img/levels-bluey-b-barlevel.png)
1540
1644
 
1541
1645
 
1542
- See also: [unregisterTheme()](#unregistertheme-name)
1646
+ See also: [unregisterTheme()](#unregistertheme)
1543
1647
 
1544
1648
  ?> Any color theme, including the built-in ones, may be modified at any time by simply re-registering the same theme name.
1545
1649
 
1650
+ ### `renderFrame()`
1651
+
1652
+ *Available since v5.0.0*
1653
+
1654
+ Stops normal analyzer animation and renders a single frame, using custom data.
1655
+
1656
+ **Syntax:**
1657
+
1658
+ ```js
1659
+ renderFrame(barData)
1660
+ ```
1661
+
1662
+ Parameter | type | description
1663
+ ----------|---------|-------------
1664
+ `barData` | *array* | An array of numbers between `0.0` and `1.0`, each corresponding to one analyzer bar. Each array element can also be an array of two numbers, for dual-channel layouts.
1665
+
1666
+ **Return value:** none (`undefined`).
1667
+
1546
1668
  ### `setCanvasSize()`
1547
1669
 
1548
1670
  Shortand hand method for setting both [`height`](#height) and [`width`](#width) properties at once.
@@ -1567,27 +1689,35 @@ setFreqRange(minFreq, maxFreq)
1567
1689
 
1568
1690
  **Return value:** none (`undefined`).
1569
1691
 
1570
- ### `setLeds()`
1692
+ ### `setLedProps()`
1571
1693
 
1572
1694
  *Available since v5.0.0; formerly `setLedParams()` (since v3.2.0)*
1573
1695
 
1574
- Customizes the appearance of LED elements used to create the [`ledBars`](#ledbars) effect.
1696
+ Customizes the appearance of the [`ledBars`](#ledbars) effect.
1575
1697
 
1576
1698
  **Syntax:**
1577
1699
 
1578
1700
  ```js
1579
- setLeds(ledHeight, gapHeight)
1701
+ setLedProps()
1702
+ setLedProps(props)
1580
1703
  ```
1581
1704
 
1582
- parameter | type | description | default
1705
+ **If `props` is omitted or not an object, ALL properties are reset to their default values.**
1706
+
1707
+ To reset a specific property to its default, set it to `null` in the passed object.
1708
+
1709
+ Property | type | description | default
1583
1710
  ------------|----------|-----------------|----------:
1584
1711
  `ledHeight` | *number* | Height, in pixels, of each LED element. **A value of `0` will match the bar width (generates square LEDs).** | `8`
1585
- `gapHeight` | *number* | Vertical gap, in pixels, between two consecutive LED elements. **A value of `0` will match the current [bar spacing](#barSpace).** | `8`
1586
-
1587
- **If called with no argument, or if ANY of the values is invalid, BOTH parameters are reset to their default values.**
1712
+ `gapHeight` | *number* | Vertical gap, in pixels, between two consecutive LED elements. **A value of `0` will match the current [bar spacing](#barSpace).** | `5`
1713
+ `maskAlpha` | *number* | Transparency of the LED mask, between `0.0` (fully transparent) and `1.0` (fully opaque). | `0.2`
1714
+ `maskLightness` | *number* | Color lightness for the LED mask, between `0` (pure black) and `100` (pure white), with `50` being the normal color intensity. **A value of `-1` will preserve the original lightness of theme colors.** | `-1`
1715
+ `maskSaturation` | *number* | Color saturation for the LED mask, between `0` (grayscale) and `100` (full saturation). **A value of `-1` will preserve the original saturation of theme colors.** | `20`
1588
1716
 
1589
1717
  **Return value:** none (`undefined`).
1590
1718
 
1719
+ See also [`getLedProps()`](#getledprops) and [`showLedMask`](#showledmask).
1720
+
1591
1721
  ?> You can experiment with different values in the [fluid demo](https://audiomotion.dev/demo/fluid.html).
1592
1722
 
1593
1723
  ### `setOptions()`
@@ -1619,153 +1749,152 @@ setSensitivity(minDecibels, maxDecibels)
1619
1749
 
1620
1750
  **Return value:** none (`undefined`).
1621
1751
 
1622
- ### `setTheme()`
1752
+ ### `setScaleProps()`
1623
1753
 
1624
1754
  *Available since v5.0.0*
1625
1755
 
1626
- Sets the color theme for one or both analyzer channels.
1756
+ Customize the scale appearance on one or both axes.
1627
1757
 
1628
1758
  **Syntax:**
1629
1759
 
1630
1760
  ```js
1631
- setTheme(name, channel)
1632
- setTheme(name, modifiers, channel)
1633
- setTheme(themeObject, channel)
1761
+ setScaleProps()
1762
+ setScaleProps(props)
1634
1763
  ```
1635
1764
 
1636
- Parameter | type | description
1637
- --------------|--------|------------------
1638
- `name` | *string* or *array* | theme name, or an array of theme names - must be a name as returned by [`getThemeList()`](#getthemelist)
1639
- `modifiers` | *object* | *(optional)* a modifiers object, as returned by [`getThemeModifiers()`](#getthememodifiers)
1640
- `themeObject` | *object* or *array* | a theme object, as returned by [`getTheme()`](#gettheme) or an array of such objects
1641
- `channel` | *number* | *(optional)* channel to set (`0` = left, `1` = right)
1765
+ **If `props` is omitted, ALL properties will be reset to their default values.**
1642
1766
 
1643
- When passing arrays for `name` or `themeObject` you can assign different themes to each channel at once.
1644
- When using a single `name` or `themeObject`, if `channel` is not specified, the same theme will be applied to both channels.
1767
+ `props` object:
1645
1768
 
1646
- !> Note that when setting theme modifiers, properties not defined in the passed object will be reset to their default values. To selectively enable or disable modifiers while preserving others, use [`setThemeModifiers( name, state )`](#setthememodifiers).
1769
+ Property | type | description
1770
+ ---------|----------|-------------
1771
+ `xAxis` | *object* | X-axis scale properties (see below). A value of `null` will reset only the X-axis properties to their defaults.
1772
+ `yAxis` | *object* | Y-axis scale properties (see below). A value of `null` will reset only the Y-axis properties to their defaults.
1647
1773
 
1648
- **Return value:** none (`undefined`).
1774
+ `xAxis` object (all properties are optional):
1649
1775
 
1650
- See also [`channelLayout`](#channellayout), [`registerTheme()`](#registertheme) and [`spreadGradient`](#spreadgradient).
1776
+ Property | type | description | default
1777
+ -------------------|-----------|-------------|---------
1778
+ `backgroundColor` | *string* | Background color of the X-axis. Any valid CSS color format is acceptable. Use a blank string or `"transparent"` for fully transparent background | `"#0008"`
1779
+ `color` | *string* | Color of labels | `"#fff"`
1780
+ `fontSize` | *number* | Font size for labels. For responsive behavior, values between `0.0` and `1.0` represent a fraction of one tenth of the canvas width or height (whichever is smaller). A minimum of 10px is enforced for the computed value. Values greater than `1` are interpreted as fixed pixel sizes. | `0.15`
1781
+ `highlightColor` | *string* | Color used to highlight *C* notes when [`showScaleX`](#showscalex) is set to `"notes"`, and for labels highlighted via `labels` property (see below) | `"#4f4"`
1782
+ `labels` | *array* | Custom labels displayed when [`showScaleX`](#showscalex) is set to `"custom"` or `"freqs+custom"`. Each element of the array must be either a number, representing the frequency in Hz, or an array of **[ &lt;frequency&gt; *(number)*, &lt;label&gt; *(string)*, &lt;highlight&gt; *(boolean, optional)* ]** (see example below) | octaves center frequencies
1783
+ `overlay` | *boolean* | Whether the X-axis should overlay the bottom of the analyzer area | `false`
1651
1784
 
1652
- ### `setThemeModifiers()`
1785
+ `yAxis` object (all properties are optional):
1653
1786
 
1654
- **Syntax:**
1787
+ Property | type | description | default
1788
+ -------------------|-----------|-------------|---------
1789
+ `color` | *string* | Color of labels and lines | `"#888"`
1790
+ `compositing` | *string* | Compositing operation used to draw labels and lines. See [Reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation). **Note: some compositing operations may hinder or prevent the proper visualization of analyzer graphs.** | `"destination-over"`
1791
+ `dbInterval` | *number* | Interval between labels, in decibels. Applied when [`showScaleY`](#showscaley) is set to `"db"`. | `6`
1792
+ `fontSize` | *number* | Font size for labels. For responsive behavior, values between `0.0` and `1.0` represent a fraction of one tenth of the canvas width or height (whichever is smaller). A minimum of 10px is enforced for the computed value. Values greater than `1` are interpreted as fixed pixel sizes. | `0.15`
1793
+ `lineDash` | *array* | Line style. See [format reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash) | `[2,4]`
1794
+ `percentInterval` | *number* | Interval between labels, in percentage values. Applied when [`showScaleY`](#showscaley) is set to `"percent"` | `20`
1795
+ `showSubdivisions` | *boolean* | Whether to show subdivision lines between two labels | `true`
1796
+ `showUnit` | *boolean* | Whether to display the scale unit ("dB" or "%") at the top of the axis | `true`
1797
+ `subLineColor` | *string* | Line color used for subdivisions | `"#555"`
1798
+ `subLineDash` | *array* | Line style for subdivisions (see `lineDash` above) | `[2,8]`
1655
1799
 
1656
- ```js
1657
- setThemeModifiers()
1658
- setThemeModifiers(modifier, state, channel)
1659
- setThemeModifiers(modifiersObject, channel)
1660
- ```
1800
+ **Return value:** none (`undefined`).
1661
1801
 
1662
- Parameter | type | description
1663
- --------------|--------|------------------
1664
- `modifier` | *string* | modifier to set (see below)
1665
- `state` | *boolean* | desired state for selected modifier
1666
- `modifiersObject` | *object* | modifiers object, as returned by [`getThemeModifiers()`](#getthememodifiers)
1667
- `channel` | *number* | *(optional)* channel to set (`0` = left, `1` = right)
1802
+ **Example usage:**
1668
1803
 
1669
- Modifier | description
1670
- ---------|----------------
1671
- `"horizontal"` | Renders the color gradient horizontally across the screen, instead of vertically - has no effect in [`radial`](#radial) spectrum or when [`ledBars`](#ledbars) is set to `"vintage"`
1672
- `"revert"` | Reverts the order of the theme colors
1804
+ ```js
1805
+ audioMotion.setScaleProps({
1806
+ xAxis: {
1807
+ backgroundColor: '', // transparent background on the axis bar
1808
+ labels: [
1809
+ [ 440, 'A4', true ], // highlight "A4" label at 440 Hz
1810
+ 800, // additional label at 800 Hz
1811
+ [ 3000, '|' ], // just a tick mark at 3 kHz
1812
+ ],
1813
+ },
1814
+ yAxis: {
1815
+ compositing: 'screen',
1816
+ percentInterval: 10,
1817
+ showSubdivisions: false,
1818
+ }
1819
+ });
1820
+ ```
1673
1821
 
1674
- **Return value:** none (`undefined`).
1822
+ See also [`getScaleProps()`](#getscaleprops), [`showScaleX`](#showscalex) and [`showScaleY`](#showscaley).
1675
1823
 
1676
- ### `setXAxis()`
1824
+ ### `setTheme()`
1677
1825
 
1678
1826
  *Available since v5.0.0*
1679
1827
 
1680
- Customize the appearance of the X-axis labels.
1828
+ Sets the color theme for one or both analyzer channels.
1681
1829
 
1682
1830
  **Syntax:**
1683
1831
 
1684
1832
  ```js
1685
- setXAxis()
1686
- setXAxis(options)
1833
+ // set same theme (and modifiers) on both channels
1834
+ setTheme() // reset themes and modifiers to defaults
1835
+ setTheme(name)
1836
+ setTheme(name, modifiers)
1837
+ setTheme(themeObject)
1838
+
1839
+ // set different theme (and modifiers) on each channel
1840
+ setTheme([name, name])
1841
+ setTheme([themeObject, themeObject])
1842
+
1843
+ // set theme (and modifiers) per channel
1844
+ setTheme(channel) // reset to defaults only on given channel
1845
+ setTheme(channel, name)
1846
+ setTheme(channel, name, modifiers)
1847
+ setTheme(channel, themeObject)
1687
1848
  ```
1688
1849
 
1689
- **If called with no argument, all properties will be reset to their default values.**
1850
+ Parameter | type | description
1851
+ --------------|----------|------------------
1852
+ `channel` | *number* | Channel index to set (`0` = left, `1` = right)
1853
+ `name` | *string* | Valid theme name - see [`getThemeList()`](#getthemelist)
1854
+ `modifiers` | *object* | Modifiers object - see [`setThemeModifiers()`](#setthememodifiers)
1855
+ `themeObject` | *object* | Theme object, as returned by [`getTheme()`](#gettheme) with the `includeModifiers` argument set to `true`
1690
1856
 
1691
- If `options` is defined, it should be an object with the structure below (all properties are optional).
1857
+ When passing arrays for `name` or `themeObject` you can assign different themes to each channel at once.
1858
+ When using a single `name` or `themeObject`, if `channel` is not specified, the same settings will be applied to both channels.
1692
1859
 
1693
- property | type | description | default
1694
- -------------------|-----------|-------------|---------
1695
- `addLabels` | *boolean* | Contents of `labels` will be *added* to the default labels, instead of replacing them | `false`
1696
- `backgroundColor` | *string* | Background color of the X-axis; any valid CSS color format is acceptable; use a blank string or 'transparent' for fully transparent background | `"#0008"`
1697
- `color` | *string* | Color of labels | `"#fff"`
1698
- `height` | *number* | Height of the X-axis; a number between `0.0` and `1.0` (recommended for responsivity) represents a fraction of the canvas width or height, whichever is smaller; numbers greater than 1 represent a fixed value in pixels | `0.03`
1699
- `highlightColor` | *string* | Color used to highlight *C* notes when [`noteLabels`](#notelabels) is *true*, or those highlighted via `labels` definition (see below) | `"#4f4"`
1700
- `labels` | *array* | Custom labels; each element of the array must be either a number, representing the frequency, or an array of [frequency&lt;number&gt;, label&lt;string&gt;, highlight?&lt;boolean&gt;] | octaves center frequencies
1701
- `overlay` | *boolean* | Whether the X-axis should overlay the bottom of the analyzer area | `false`
1860
+ **When called without arguments, resets theme and modifiers to defaults on both channels. If only a channel is specified, resets on given channel only.**
1702
1861
 
1703
1862
  **Return value:** none (`undefined`).
1704
1863
 
1705
- **Example usage:**
1864
+ See also [`channelLayout`](#channellayout), [`registerTheme()`](#registertheme), [`setThemeModifiers()`](#setthememodifiers) and [`spreadGradient`](#spreadgradient).
1706
1865
 
1707
- ```js
1708
- audioMotion.setXAxis({
1709
- addLabels: true, // add custom labels on top of default ones
1710
- backgroundColor: '', // transparent background on the axis bar
1711
- labels: [
1712
- [ 440, 'A4', true ], // highlight A4 label at 440 Hz
1713
- 800, // additional label at 800 Hz
1714
- [ 3000, '|' ], // just a tick mark at 3 kHz
1715
- ],
1716
- });
1717
- ```
1718
-
1719
- > **Notes:**
1720
- >
1721
- > - The axis height also defines the labels font size (half its value). A minimum of 20 pixels is enforced for the computed `height` value;
1722
- > - Custom labels are not displayed when [`noteLabels`](#notelabels) is *true*.
1723
-
1724
- ### `setYAxis()`
1866
+ ### `setThemeModifiers()`
1725
1867
 
1726
1868
  *Available since v5.0.0*
1727
1869
 
1728
- Customize the appearance of the Y-axis labels.
1870
+ Sets theme modifiers for one or both analyzer channels.
1729
1871
 
1730
1872
  **Syntax:**
1731
1873
 
1732
1874
  ```js
1733
- setYAxis()
1734
- setYAxis(options)
1875
+ setThemeModifiers() // reset modifiers to defaults on both channels
1876
+ setThemeModifiers(channel) // reset to defaults on given channel only
1877
+ setThemeModifiers(modifiers) // set same modifiers on both channels
1878
+ setThemeModifiers(channel, modifiers) // set modifiers on given channel only
1735
1879
  ```
1736
1880
 
1737
- **If called with no argument, all properties will be reset to their default values.**
1881
+ Parameter | type | description
1882
+ ------------|----------|------------------
1883
+ `channel` | *number* | Channel index to set (`0` = left, `1` = right)
1884
+ `modifiers` | *object* | Modifiers object (see below)
1738
1885
 
1739
- If `options` is defined, it should be an object with the structure below (all properties are optional).
1886
+ **When called without arguments, resets modifiers to defaults on both channels. If only a channel is specified, resets on given channel only.**
1740
1887
 
1741
- property | type | description | default
1742
- -----------------|---------|-------------|---------
1743
- color | string | Color of labels and lines | `"#888"`
1744
- dbInterval | number | Interval between labels, in decibels - used when [`linearAmplitude`](#linearamplitude) is *false* | `10`
1745
- linearInterval | number | Interval between labels, in percentage values - used when [`linearAmplitude`](#linearamplitude) is *true* | `20`
1746
- lineDash | array | Line style - [format reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash) | `[2,4]`
1747
- operation | array | Compositing operation used to draw labels and lines - [Reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation) | `"destination-over"`
1748
- showSubdivisions | array | Whether to show subdivision lines between two labels | `true`
1749
- subLineColor | string | Line color used for subdivisions | `"#555"`
1750
- subLineDash | array | Line style for subdivisions (see `lineDash` above) | `[2,8]``
1751
- width | number | Width of the Y-axis; a number between `0.0` and `1.0` represents a fraction of the canvas width or height, whichever is smaller; numbers greater than `1` represent a fixed value in pixels | `0.03`
1888
+ `modifiers` object structure:
1752
1889
 
1753
- **Return value:** none (`undefined`).
1754
-
1755
- **Example usage:**
1890
+ Property | type | description
1891
+ -------------|-----------|---------------
1892
+ `horizontal` | *boolean* | `true` to create a horizontal color gradient - has no effect in [`radial`](#radial) spectrum or when [`ledBars`](#ledbars) is set to `"vintage"`
1893
+ `reverse` | *boolean* | `true` to reverse the order in which theme colors are applied
1756
1894
 
1757
- ```js
1758
- audioMotion.setYAxis({
1759
- linearInterval: 10,
1760
- operation: 'screen',
1761
- showSubdivisions: false,
1762
- });
1763
- ```
1895
+ **Return value:** none (`undefined`).
1764
1896
 
1765
- > **Notes:**
1766
- >
1767
- > - The axis width also affects the labels font size (half its value). A minimum of 20 pixels is enforced for the computed `width` value;
1768
- > - Some values of `operation` may make the visualization of analyzer graphs impossible.
1897
+ See also [`getThemeModifiers()`](#getthememodifiers) and [`setTheme()`](#settheme).
1769
1898
 
1770
1899
  ### `start()`
1771
1900
 
@@ -1804,7 +1933,7 @@ toggleAnalyzer()
1804
1933
  toggleAnalyzer(force)
1805
1934
  ```
1806
1935
 
1807
- parameter | type | description
1936
+ Parameter | type | description
1808
1937
  ----------|------|------------
1809
1938
  `force` | *boolean* | forces the desired state - `true` to start or `false` to stop the analyzer
1810
1939
 
@@ -1823,6 +1952,50 @@ You can set the [`fsElement`](#fselement-htmlelement-object) constructor option
1823
1952
 
1824
1953
  ?> Fullscreen requests must be triggered by user action, like a key press or mouse click, so you must call this method from within a user-generated event handler.
1825
1954
 
1955
+ ### `unregisterTheme()`
1956
+
1957
+ *Available since v5.0.0*
1958
+
1959
+ Unregisters a color theme.
1960
+
1961
+ **Syntax:**
1962
+
1963
+ ```js
1964
+ unregisterTheme(name)
1965
+ ```
1966
+
1967
+ Parameter | type | description
1968
+ ----------|----------|---------------
1969
+ `name` | *string* | Valid theme name. May include built-in themes. See [`getThemeList()`](#getthemelist).
1970
+
1971
+ **Return value:** a *boolean* value. `true` on success, or `false` if theme is in use or not registered.
1972
+
1973
+ See also [`registerTheme()`](#registertheme).
1974
+
1975
+
1976
+ ## Static Methods
1977
+
1978
+ ### `weightingGain()`
1979
+
1980
+ *Available since v5.0.0*
1981
+
1982
+ Returns gain, in decibels, to correct the amplitude value at a given frequency, according to the specified weighting filter.
1983
+
1984
+ **Syntax:**
1985
+
1986
+ ```js
1987
+ AudioMotionAnalyzer.weightingGain(frequency, filter)
1988
+ ```
1989
+
1990
+ *Since this is a static method, always call it as `AudioMotionAnalyzer.weightingGain()`, rather than as a method of an instantiated object.*
1991
+
1992
+ Parameter | type | description
1993
+ ------------|----------|-----------------
1994
+ `frequency` | *number* | Frequency value, in Hz
1995
+ `filter` | *string* | A valid [weighting filter](#weightingfilter)
1996
+
1997
+ **Return value:** a *number*, representing the gain or attenuation (in dB) to be applied to the original amplitude value.
1998
+
1826
1999
 
1827
2000
  ## Custom Errors
1828
2001
 
@@ -1832,11 +2005,11 @@ You can set the [`fsElement`](#fselement-htmlelement-object) constructor option
1832
2005
 
1833
2006
  The `code` property is a *number*. [Constants](#constants) are available to simplify checking for error codes.
1834
2007
 
1835
- code | Constant | Error description
1836
- -----|---------------------|--------------------
1837
- `1` | `ERR_AUDIO_CONTEXT_FAIL` | Could not create audio context. The user agent may lack support for the Web Audio API.
1838
- `2` | `ERR_INVALID_AUDIO_CONTEXT` | [Audio context](#audioctx-read-only) provided by user is not valid.
1839
- `3` | `ERR_INVALID_AUDIO_SOURCE` | Audio source provided in [`source`](#source) option or [`connectInput()`](#connectinput) method is not an instance of HTMLMediaElement or AudioNode.
2008
+ `code` | Constant | Error description
2009
+ -------|---------------------|--------------------
2010
+ `1` | `ERR_AUDIO_CONTEXT_FAIL` | Could not create audio context. The user agent may lack support for the Web Audio API.
2011
+ `2` | `ERR_INVALID_AUDIO_CONTEXT` | [Audio context](#audioctx-read-only) provided by user is not valid.
2012
+ `3` | `ERR_INVALID_AUDIO_SOURCE` | Audio source provided in [`source`](#source) option or [`connectInput()`](#connectinput) method is not an instance of *HTMLMediaElement*, *MediaStream* or *AudioNode*.
1840
2013
 
1841
2014
 
1842
2015
  ## Known Issues
@@ -1865,7 +2038,7 @@ The `import` statement must be inside a `script` which has the `type="module"` p
1865
2038
 
1866
2039
  ```html
1867
2040
  <script type="module">
1868
- import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@alpha/+esm';
2041
+ import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@beta/+esm';
1869
2042
 
1870
2043
  // your code here
1871
2044
  </script>
@@ -1894,7 +2067,7 @@ myAudio.crossOrigin = 'anonymous';
1894
2067
  ### Sound only plays after the user clicks somewhere on the page. <!-- {docsify-ignore} -->
1895
2068
 
1896
2069
  Browser autoplay policy dictates that audio output can only be initiated by a user gesture, and this policy is enforced by Web Audio API
1897
- by putting [*AudioContext*](#audioctx-audiocontext-object-read-only) objects into *suspended* mode if they're not created on user action.
2070
+ by putting [*AudioContext*](#audioctx-read-only) objects into *suspended* mode if they're not created on user action.
1898
2071
 
1899
2072
  **audioMotion-analyzer** tries to automatically start its *AudioContext* on the first click on the page. However, if you're using an `audio`
1900
2073
  or `video` element with the `controls` property, clicks on those native media controls cannot be detected by JavaScript, so the audio will