audiomotion-analyzer 5.0.0-alpha.2 → 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 +222 -170
- package/dist/index.js +769 -741
- package/package.json +1 -1
- package/src/audioMotion-analyzer.js +754 -753
- package/src/index.d.ts +50 -16
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## About
|
|
2
2
|
|
|
3
|
-
> **
|
|
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
|
|
|
@@ -38,11 +38,13 @@ What users are saying:
|
|
|
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
|
-
[](https://audiomotion.dev/demo/
|
|
45
|
+
[](https://audiomotion.dev/demo/beta/)
|
|
44
46
|
|
|
45
|
-
?> https://audiomotion.dev/demo/
|
|
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@
|
|
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@
|
|
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@
|
|
101
|
+
<script src="https://cdn.jsdelivr.net/npm/audiomotion-analyzer@beta"></script>
|
|
100
102
|
<script>
|
|
101
103
|
// available as AudioMotionAnalyzer global
|
|
102
104
|
</script>
|
|
@@ -305,6 +307,8 @@ import {
|
|
|
305
307
|
FILTER_C,
|
|
306
308
|
FILTER_D,
|
|
307
309
|
FILTER_468,
|
|
310
|
+
FILTER_TILT3,
|
|
311
|
+
FILTER_TILT45,
|
|
308
312
|
LABELS_X_CUSTOM,
|
|
309
313
|
LABELS_X_FREQS,
|
|
310
314
|
LABELS_X_FREQS_CUSTOM,
|
|
@@ -320,6 +324,9 @@ import {
|
|
|
320
324
|
LEDS_MODERN,
|
|
321
325
|
LEDS_OFF,
|
|
322
326
|
LEDS_VINTAGE,
|
|
327
|
+
MIRROR_LEFT,
|
|
328
|
+
MIRROR_OFF,
|
|
329
|
+
MIRROR_RIGHT,
|
|
323
330
|
MODE_BARS,
|
|
324
331
|
MODE_GRAPH,
|
|
325
332
|
PEAKS_DROP,
|
|
@@ -351,7 +358,7 @@ import {
|
|
|
351
358
|
|
|
352
359
|
Determines whether each bar's opacity is affected by its amplitude. Only effective in **Bars** [`mode`](#mode).
|
|
353
360
|
|
|
354
|
-
|
|
361
|
+
Value | [Constant](#constants) | Description
|
|
355
362
|
---------|------------------------|--------------
|
|
356
363
|
`"off"` | `ALPHABARS_OFF` | Disables effect
|
|
357
364
|
`"on"` | `ALPHABARS_ON` | Bars with higher amplitude are rendered more opaque while those with lower amplitude are mode transparent
|
|
@@ -369,7 +376,7 @@ For effect priority when combined with other settings, see [`isAlphaBars`](#isal
|
|
|
369
376
|
|
|
370
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).
|
|
371
378
|
|
|
372
|
-
|
|
379
|
+
Value | Reference | Octaves' center frequencies
|
|
373
380
|
--------|-----------------|----------------------------
|
|
374
381
|
`false` | [A 440 pitch standard](http://hyperphysics.phy-astr.gsu.edu/hbase/Music/et.html) (equal temperament scale) | 
|
|
375
382
|
`true` | [ANSI S1.11-2004 standard](https://archive.org/details/gov.law.ansi.s1.11.2004) (base-10 scale) | 
|
|
@@ -416,7 +423,7 @@ How much of an octave should each analyzer band represent, or how many bands sho
|
|
|
416
423
|
When [`frequencyScale`](#frequencyscale-string) is set to `"log"`, this setting defines which fraction of an octave is included in each bar.
|
|
417
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.
|
|
418
425
|
|
|
419
|
-
|
|
426
|
+
Value | [Constant](#constants) | Description
|
|
420
427
|
:----:|------------------------|-----------------
|
|
421
428
|
`0` | `BANDS_FFT` | Discrete frequencies provided by the [FFT](https://en.wikipedia.org/wiki/Fast_Fourier_transform) computation
|
|
422
429
|
`1` | `BANDS_OCTAVE_FULL` | Full octave bands or 10 bands
|
|
@@ -466,7 +473,7 @@ See also the [`canvas`](#canvas) constructor option.
|
|
|
466
473
|
|
|
467
474
|
Defines the number and layout of analyzer channels.
|
|
468
475
|
|
|
469
|
-
|
|
476
|
+
Value | [Constant](#constants) | Description
|
|
470
477
|
--------------------|------------------------|-----------------
|
|
471
478
|
`"single"` | `LAYOUT_SINGLE` | Single channel analyzer, representing the combined output of both left and right channels.
|
|
472
479
|
`"dual-combined"` | `LAYOUT_COMBINED` | Dual channel analyzer, both channels overlaid. Works best with semi-transparent **Graph** [`mode`](#mode) or [`outlineBars`](#outlinebars).
|
|
@@ -486,7 +493,7 @@ See also [`setTheme()`](#settheme) and [`spreadGradient`](#spreadgradient).
|
|
|
486
493
|
|
|
487
494
|
Selects the desired mode for coloring the analyzer bars. This property has no effect in **Graph** [`mode`](#mode).
|
|
488
495
|
|
|
489
|
-
|
|
496
|
+
Value | [Constant](#constants) | Description | Preview ('prism' theme)
|
|
490
497
|
--------------|------------------------|-------------|-------------------------
|
|
491
498
|
`"gradient"` | `COLORMODE_GRADIENT` | Analyzer bars are painted with a gradient of the selected [`theme`](#theme-string)'s colors. This is the default behavior. | 
|
|
492
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. | 
|
|
@@ -548,7 +555,7 @@ Current frame rate.
|
|
|
548
555
|
|
|
549
556
|
Scale used to represent frequencies in the horizontal axis.
|
|
550
557
|
|
|
551
|
-
|
|
558
|
+
Value | [Constant](#constants) | Description | Scale preview (10Hz - 24kHz range)
|
|
552
559
|
-----------|------------------------|-------------|-------------------------------------
|
|
553
560
|
`"bark"` | `SCALE_BARK` | Bark scale | 
|
|
554
561
|
`"linear"` | `SCALE_LINEAR` | Linear scale | 
|
|
@@ -655,15 +662,15 @@ Returns `true` when round bars are effectively being displayed, i.e., [`roundBar
|
|
|
655
662
|
|
|
656
663
|
Determines the appearance of the LED bars. Only effective in **Bars** [`mode`](#mode), when [`bandResolution`](#bandresolution) > `0` and [`radial`](#radial) set to `0`.
|
|
657
664
|
|
|
658
|
-
|
|
665
|
+
Value | [Constant](#constants) | Description | Preview
|
|
659
666
|
------------|------------------------|-------------|----------
|
|
660
667
|
`"off"` | `LEDS_OFF` | Disables effect | 
|
|
661
668
|
`"modern"` | `LEDS_MODERN` | Gradient-colored LEDs when [`colorMode`](#colormode) is set to `"gradient"` | 
|
|
662
669
|
`"vintage"` | `LEDS_VINTAGE` | Single color LEDs, determined by the `level` property of each color - see [registerTheme()](#registertheme) | 
|
|
663
670
|
|
|
664
|
-
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
|
|
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.
|
|
665
672
|
|
|
666
|
-
?> The
|
|
673
|
+
?> The appearance of the LED bars can be customized via [`setLedProps()`](#setledprops) method.
|
|
667
674
|
|
|
668
675
|
For effect priority when combined with other settings, see [`isLedBars`](#isledbars-read-only).
|
|
669
676
|
|
|
@@ -737,9 +744,9 @@ See also [`minDecibels`](#mindecibels) and [`setSensitivity()`](#setsensitivity)
|
|
|
737
744
|
Determines the maximum desired frame rate for the analyzer animation, in frames per second.
|
|
738
745
|
|
|
739
746
|
A value of `0` means the animation will run at the highest frame rate possible, limited by the refresh rate of your display.
|
|
740
|
-
For example, if you have a 144Hz monitor, the frame rate may reach up to 144
|
|
747
|
+
For example, if you have a 144Hz monitor, the frame rate may reach up to 144 FPS.
|
|
741
748
|
|
|
742
|
-
Usually, 60
|
|
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.
|
|
743
750
|
|
|
744
751
|
### `maxFreq`
|
|
745
752
|
|
|
@@ -780,11 +787,11 @@ When [`channelLayout`](#channellayout-string) is **dual-horizontal**, this prope
|
|
|
780
787
|
|
|
781
788
|
For other layouts, it horizontally mirrors the spectrum image to the left or right side.
|
|
782
789
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
`-1` | Low frequencies meet at the center of the screen
|
|
786
|
-
`0` | No mirror effect or change to axis orientation (default)
|
|
787
|
-
`1` | High frequencies meet at the center of the screen
|
|
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
|
|
788
795
|
|
|
789
796
|
**Note:** On [`radial`](#radial) spectrum with channel layouts other than *dual-horizontal*, both `1` and `-1` have the same effect.
|
|
790
797
|
|
|
@@ -794,7 +801,7 @@ value | Description
|
|
|
794
801
|
|
|
795
802
|
Determines the visualization mode.
|
|
796
803
|
|
|
797
|
-
|
|
804
|
+
Value | [Constant](#constants) | Description
|
|
798
805
|
----------|------------------------|-----------------
|
|
799
806
|
`"bars"` | `MODE_BARS` | displays bars for each frequency or frequency band
|
|
800
807
|
`"graph"` | `MODE_GRAPH` | connects frequency/bands data points into continuous line with optional filled area graph
|
|
@@ -967,7 +974,7 @@ You can refer to this value to adjust any additional drawings done in the canvas
|
|
|
967
974
|
|
|
968
975
|
Whether to render the spectrum analyzer as a circle with radial bars.
|
|
969
976
|
|
|
970
|
-
|
|
977
|
+
Value | [Constant](#constants) | Description
|
|
971
978
|
------|------------------------|----------------
|
|
972
979
|
`0` | `RADIAL_OFF` | Disables radial
|
|
973
980
|
`1` | `RADIAL_OUTWARD` | Bars grow towards the edges of the screen
|
|
@@ -1070,13 +1077,15 @@ Whether to display the "unlit" LED elements. Has no effect when [`ledBars`](#led
|
|
|
1070
1077
|
:----------------------:|:-----------------------:
|
|
1071
1078
|
 | 
|
|
1072
1079
|
|
|
1080
|
+
?> The appearance of the LED mask can be customized via [`setLedProps()`](#setledprops).
|
|
1081
|
+
|
|
1073
1082
|
### `showPeaks`
|
|
1074
1083
|
|
|
1075
1084
|
**Value:** a *string*. The default value is `"drop"`.
|
|
1076
1085
|
|
|
1077
1086
|
Determines the display and behavior of amplitude peaks.
|
|
1078
1087
|
|
|
1079
|
-
|
|
1088
|
+
Value | [Constant](#constants) | Description
|
|
1080
1089
|
---------|------------------------|--------------
|
|
1081
1090
|
`"off"` | `PEAKS_OFF` | Disable display of amplitude peaks and [`peakLine`](#peakline)
|
|
1082
1091
|
`"drop"` | `PEAKS_DROP` | Display peaks that fall down over time
|
|
@@ -1095,12 +1104,12 @@ Whether to display scale labels on the X-axis.
|
|
|
1095
1104
|
Value | [Constant](#constants) | Description
|
|
1096
1105
|
-----------------|-------------------------|---------------
|
|
1097
1106
|
`"off"` | `LABELS_X_OFF` | Do not display scale labels on the X-axis.
|
|
1098
|
-
`"custom"` | `LABELS_X_CUSTOM` | Display custom `labels` defined via [`
|
|
1107
|
+
`"custom"` | `LABELS_X_CUSTOM` | Display custom `labels` defined via [`setScaleProps()`](#setscaleprops).
|
|
1099
1108
|
`"freqs"` | `LABELS_X_FREQS` | Display octaves center frequencies - see also [`ansiBands`](#ansibands).
|
|
1100
|
-
`"freqs
|
|
1109
|
+
`"freqs+custom"` | `LABELS_X_FREQS_CUSTOM` | Display center frequencies and any additional custom labels.
|
|
1101
1110
|
`"notes"` | `LABELS_X_NOTES` | Display musical note labels.
|
|
1102
1111
|
|
|
1103
|
-
Several display properties of the scale can be customized via [`
|
|
1112
|
+
Several display properties of the scale can be customized via [`setScaleProps()`](#setscaleprops) method.
|
|
1104
1113
|
|
|
1105
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
|
|
|
@@ -1120,7 +1129,7 @@ Value | [Constant](#constants) | Description
|
|
|
1120
1129
|
|
|
1121
1130
|
This option has no effect when [`radial`](#radial) is active or [`alphaBars`](#alphabars) is set to `"full"`.
|
|
1122
1131
|
|
|
1123
|
-
Several display properties of the scale can be customized via [`
|
|
1132
|
+
Several display properties of the scale can be customized via [`setScaleProps()`](#setscaleprops) method.
|
|
1124
1133
|
|
|
1125
1134
|
See also [`minDecibels`](#mindecibels) and [`maxDecibels`](#maxdecibels).
|
|
1126
1135
|
|
|
@@ -1418,6 +1427,14 @@ Use this method inside your callback function to create additional visual effect
|
|
|
1418
1427
|
|
|
1419
1428
|
**Return value:** a *number* between `0.0` and `1.0`, or `null` if preset name is invalid.
|
|
1420
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
|
+
|
|
1421
1438
|
### `getOptions()`
|
|
1422
1439
|
|
|
1423
1440
|
*Available since v4.4.0*
|
|
@@ -1441,56 +1458,46 @@ Callbacks and [constructor-specific properties](#constructor-specific-options) a
|
|
|
1441
1458
|
|
|
1442
1459
|
See also [`setOptions()`](#setoptions).
|
|
1443
1460
|
|
|
1444
|
-
### `
|
|
1461
|
+
### `getScaleProps()`
|
|
1445
1462
|
|
|
1446
1463
|
*Available since v5.0.0*
|
|
1447
1464
|
|
|
1448
|
-
|
|
1465
|
+
Retrieves the current scale display properties on both axes.
|
|
1449
1466
|
|
|
1450
1467
|
**Syntax:**
|
|
1451
1468
|
|
|
1452
1469
|
```js
|
|
1453
|
-
|
|
1470
|
+
getScaleProps()
|
|
1454
1471
|
```
|
|
1455
1472
|
|
|
1456
|
-
**Return value:** an *object* - see [`
|
|
1457
|
-
|
|
1458
|
-
### `getScaleY()`
|
|
1459
|
-
|
|
1460
|
-
*Available since v5.0.0*
|
|
1461
|
-
|
|
1462
|
-
Returns the display properties of the Y-axis scale.
|
|
1463
|
-
|
|
1464
|
-
**Syntax:**
|
|
1465
|
-
|
|
1466
|
-
```js
|
|
1467
|
-
getScaleY()
|
|
1468
|
-
```
|
|
1469
|
-
|
|
1470
|
-
**Return value:** an *object* - see [`setScaleY()`](#setscaley) for object structure.
|
|
1473
|
+
**Return value:** an *object* - see [`setScaleProps()`](#setscaleprops) for object structure.
|
|
1471
1474
|
|
|
1472
1475
|
### `getTheme()`
|
|
1473
1476
|
|
|
1474
1477
|
*Available since v5.0.0*
|
|
1475
1478
|
|
|
1476
|
-
|
|
1479
|
+
Retrieves the active theme name and, optionally, the state of theme modifiers for one or both analyzer channels.
|
|
1477
1480
|
|
|
1478
1481
|
**Syntax:**
|
|
1479
1482
|
|
|
1480
1483
|
```js
|
|
1481
|
-
getTheme()
|
|
1482
|
-
getTheme(
|
|
1483
|
-
getTheme(
|
|
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)
|
|
1484
1488
|
```
|
|
1485
1489
|
|
|
1486
1490
|
Parameter | type | description
|
|
1487
1491
|
----------|------|-----------------
|
|
1488
|
-
`channel` | *number* |
|
|
1489
|
-
`includeModifiers` | *boolean* |
|
|
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).
|
|
1490
1494
|
|
|
1491
|
-
**Return value:**
|
|
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)
|
|
1492
1499
|
|
|
1493
|
-
See also [`setTheme()`](#settheme).
|
|
1500
|
+
See also [`getThemeModifiers()`](#getthememodifiers) and [`setTheme()`](#settheme).
|
|
1494
1501
|
|
|
1495
1502
|
### `getThemeData()`
|
|
1496
1503
|
|
|
@@ -1508,7 +1515,7 @@ getThemeData(name)
|
|
|
1508
1515
|
|
|
1509
1516
|
**Return value:** an *object* (structure below) or `null` if theme name is invalid.
|
|
1510
1517
|
|
|
1511
|
-
|
|
1518
|
+
Property | type | description
|
|
1512
1519
|
---------|------|---------------
|
|
1513
1520
|
`colorStops` | *array* | all entries are normalized as objects with `color`, `level` and `pos` properties
|
|
1514
1521
|
`peakColor` | *string* | `undefined` if not originally defined in [theme registration](#registertheme)
|
|
@@ -1549,23 +1556,15 @@ Returns the state of theme modifiers for the given channel.
|
|
|
1549
1556
|
```js
|
|
1550
1557
|
getThemeModifiers()
|
|
1551
1558
|
getThemeModifiers(channel)
|
|
1552
|
-
getThemeModifiers(modifier, channel)
|
|
1553
1559
|
```
|
|
1554
1560
|
|
|
1555
1561
|
Parameter | type | description
|
|
1556
1562
|
-----------|----------|-----------------
|
|
1557
|
-
`
|
|
1558
|
-
`channel` | *number* | *(optional)* channel to set (`0` = left, `1` = right) - if not specified, considers channel 0
|
|
1559
|
-
|
|
1560
|
-
**Return value:** a *boolean* representing the state of the selected modifier, when `modifier` is specified;
|
|
1561
|
-
otherwise, an *object* with the structure below:
|
|
1563
|
+
`channel` | *number* | Channel index (`0` = left, `1` = right) - **if omitted, considers channel 0**
|
|
1562
1564
|
|
|
1563
|
-
|
|
1564
|
-
-------------|-----------|---------------
|
|
1565
|
-
`horizontal` | *boolean* | If `true`, the color gradient is rendered horizontally, instead of vertically
|
|
1566
|
-
`revert` | *boolean* | If `true`, reverses the order in which theme colors are applied
|
|
1565
|
+
**Return value:** an *object* - see [`setThemeModifiers()`](#setthememodifiers) for object structure.
|
|
1567
1566
|
|
|
1568
|
-
See also [`getTheme()`](#gettheme)
|
|
1567
|
+
See also [`getTheme()`](#gettheme).
|
|
1569
1568
|
|
|
1570
1569
|
### `registerTheme()`
|
|
1571
1570
|
|
|
@@ -1579,21 +1578,21 @@ Registers a custom color theme.
|
|
|
1579
1578
|
registerTheme(name, options)
|
|
1580
1579
|
```
|
|
1581
1580
|
|
|
1582
|
-
|
|
1581
|
+
Parameter | type | description
|
|
1583
1582
|
----------|------|-------------
|
|
1584
1583
|
`name` | *string* | Names are **case sensitive** and will be used to select the theme via [`setTheme()`](#settheme) method.
|
|
1585
1584
|
`options` | *object* | Contains the color information (see below).
|
|
1586
1585
|
|
|
1587
1586
|
**`options` object structure:**
|
|
1588
1587
|
|
|
1589
|
-
|
|
1588
|
+
Property | type | description
|
|
1590
1589
|
-------------|--------|-------------
|
|
1591
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).
|
|
1592
1591
|
`peakColor` | *string* | Optional; if defined, **all peaks** will be painted this color, regardless of their levels.
|
|
1593
1592
|
|
|
1594
1593
|
**`colorStops` entry object structure:**
|
|
1595
1594
|
|
|
1596
|
-
|
|
1595
|
+
Property | type | description
|
|
1597
1596
|
---------|--------|-------------
|
|
1598
1597
|
`color` | *string* | Any valid CSS color format, e.g. 'red', '#f00', 'rgb(…)', 'hsl(…)', etc.
|
|
1599
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).
|
|
@@ -1644,10 +1643,28 @@ Theme | [`ledBars`](#ledbars) = `"off"` | [`ledBars`](#ledbars) = `"vintage"` |
|
|
|
1644
1643
|
**bluey-B**<br>(custom `pos` / custom `level`) |  |  | 
|
|
1645
1644
|
|
|
1646
1645
|
|
|
1647
|
-
See also: [unregisterTheme()](#unregistertheme
|
|
1646
|
+
See also: [unregisterTheme()](#unregistertheme)
|
|
1648
1647
|
|
|
1649
1648
|
?> Any color theme, including the built-in ones, may be modified at any time by simply re-registering the same theme name.
|
|
1650
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
|
+
|
|
1651
1668
|
### `setCanvasSize()`
|
|
1652
1669
|
|
|
1653
1670
|
Shortand hand method for setting both [`height`](#height) and [`width`](#width) properties at once.
|
|
@@ -1672,27 +1689,35 @@ setFreqRange(minFreq, maxFreq)
|
|
|
1672
1689
|
|
|
1673
1690
|
**Return value:** none (`undefined`).
|
|
1674
1691
|
|
|
1675
|
-
### `
|
|
1692
|
+
### `setLedProps()`
|
|
1676
1693
|
|
|
1677
1694
|
*Available since v5.0.0; formerly `setLedParams()` (since v3.2.0)*
|
|
1678
1695
|
|
|
1679
|
-
Customizes the appearance of
|
|
1696
|
+
Customizes the appearance of the [`ledBars`](#ledbars) effect.
|
|
1680
1697
|
|
|
1681
1698
|
**Syntax:**
|
|
1682
1699
|
|
|
1683
1700
|
```js
|
|
1684
|
-
|
|
1701
|
+
setLedProps()
|
|
1702
|
+
setLedProps(props)
|
|
1685
1703
|
```
|
|
1686
1704
|
|
|
1687
|
-
|
|
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
|
|
1688
1710
|
------------|----------|-----------------|----------:
|
|
1689
1711
|
`ledHeight` | *number* | Height, in pixels, of each LED element. **A value of `0` will match the bar width (generates square LEDs).** | `8`
|
|
1690
|
-
`gapHeight` | *number* | Vertical gap, in pixels, between two consecutive LED elements. **A value of `0` will match the current [bar spacing](#barSpace).** | `
|
|
1691
|
-
|
|
1692
|
-
|
|
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`
|
|
1693
1716
|
|
|
1694
1717
|
**Return value:** none (`undefined`).
|
|
1695
1718
|
|
|
1719
|
+
See also [`getLedProps()`](#getledprops) and [`showLedMask`](#showledmask).
|
|
1720
|
+
|
|
1696
1721
|
?> You can experiment with different values in the [fluid demo](https://audiomotion.dev/demo/fluid.html).
|
|
1697
1722
|
|
|
1698
1723
|
### `setOptions()`
|
|
@@ -1724,73 +1749,48 @@ setSensitivity(minDecibels, maxDecibels)
|
|
|
1724
1749
|
|
|
1725
1750
|
**Return value:** none (`undefined`).
|
|
1726
1751
|
|
|
1727
|
-
### `
|
|
1752
|
+
### `setScaleProps()`
|
|
1728
1753
|
|
|
1729
1754
|
*Available since v5.0.0*
|
|
1730
1755
|
|
|
1731
|
-
Customize the appearance
|
|
1756
|
+
Customize the scale appearance on one or both axes.
|
|
1732
1757
|
|
|
1733
1758
|
**Syntax:**
|
|
1734
1759
|
|
|
1735
1760
|
```js
|
|
1736
|
-
|
|
1737
|
-
|
|
1761
|
+
setScaleProps()
|
|
1762
|
+
setScaleProps(props)
|
|
1738
1763
|
```
|
|
1739
1764
|
|
|
1740
|
-
**If
|
|
1765
|
+
**If `props` is omitted, ALL properties will be reset to their default values.**
|
|
1766
|
+
|
|
1767
|
+
`props` object:
|
|
1741
1768
|
|
|
1742
|
-
|
|
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.
|
|
1743
1773
|
|
|
1744
|
-
|
|
1774
|
+
`xAxis` object (all properties are optional):
|
|
1775
|
+
|
|
1776
|
+
Property | type | description | default
|
|
1745
1777
|
-------------------|-----------|-------------|---------
|
|
1746
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"`
|
|
1747
1779
|
`color` | *string* | Color of labels | `"#fff"`
|
|
1748
|
-
`fontSize` | *number* | Font size for labels.
|
|
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`
|
|
1749
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"`
|
|
1750
|
-
`labels` | *array* | Custom labels displayed when [`showScaleX`](#showscalex) is set to `"custom"` or `"freqs
|
|
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 **[ <frequency> *(number)*, <label> *(string)*, <highlight> *(boolean, optional)* ]** (see example below) | octaves center frequencies
|
|
1751
1783
|
`overlay` | *boolean* | Whether the X-axis should overlay the bottom of the analyzer area | `false`
|
|
1752
1784
|
|
|
1753
|
-
|
|
1785
|
+
`yAxis` object (all properties are optional):
|
|
1754
1786
|
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
```js
|
|
1758
|
-
audioMotion.setScaleX({
|
|
1759
|
-
backgroundColor: '', // transparent background on the axis bar
|
|
1760
|
-
labels: [
|
|
1761
|
-
[ 440, 'A4', true ], // highlight "A4" label at 440 Hz
|
|
1762
|
-
800, // additional label at 800 Hz
|
|
1763
|
-
[ 3000, '|' ], // just a tick mark at 3 kHz
|
|
1764
|
-
],
|
|
1765
|
-
});
|
|
1766
|
-
```
|
|
1767
|
-
|
|
1768
|
-
See also [`showScaleX`](#showscalex).
|
|
1769
|
-
|
|
1770
|
-
### `setScaleY()`
|
|
1771
|
-
|
|
1772
|
-
*Available since v5.0.0*
|
|
1773
|
-
|
|
1774
|
-
Customize the appearance of the Y-axis scale and labels.
|
|
1775
|
-
|
|
1776
|
-
**Syntax:**
|
|
1777
|
-
|
|
1778
|
-
```js
|
|
1779
|
-
setScaleY()
|
|
1780
|
-
setScaleY(options)
|
|
1781
|
-
```
|
|
1782
|
-
|
|
1783
|
-
**If called with no argument, all properties will be reset to their default values.**
|
|
1784
|
-
|
|
1785
|
-
If `options` is defined, it should be an object with the structure below (all properties are optional).
|
|
1786
|
-
|
|
1787
|
-
property | type | description | default
|
|
1787
|
+
Property | type | description | default
|
|
1788
1788
|
-------------------|-----------|-------------|---------
|
|
1789
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"`
|
|
1790
1791
|
`dbInterval` | *number* | Interval between labels, in decibels. Applied when [`showScaleY`](#showscaley) is set to `"db"`. | `6`
|
|
1791
|
-
`fontSize` | *number* | Font size for labels.
|
|
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`
|
|
1792
1793
|
`lineDash` | *array* | Line style. See [format reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash) | `[2,4]`
|
|
1793
|
-
`operation` | *string* | Compositing operation used to draw labels and lines. See [Reference](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation). **Note: some operations may hinder or prevent the proper visualization of analyzer graphs.** | `"destination-over"`
|
|
1794
1794
|
`percentInterval` | *number* | Interval between labels, in percentage values. Applied when [`showScaleY`](#showscaley) is set to `"percent"` | `20`
|
|
1795
1795
|
`showSubdivisions` | *boolean* | Whether to show subdivision lines between two labels | `true`
|
|
1796
1796
|
`showUnit` | *boolean* | Whether to display the scale unit ("dB" or "%") at the top of the axis | `true`
|
|
@@ -1802,14 +1802,24 @@ property | type | description | default
|
|
|
1802
1802
|
**Example usage:**
|
|
1803
1803
|
|
|
1804
1804
|
```js
|
|
1805
|
-
audioMotion.
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
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
|
+
}
|
|
1809
1819
|
});
|
|
1810
1820
|
```
|
|
1811
1821
|
|
|
1812
|
-
See also [`showScaleY`](#showscaley).
|
|
1822
|
+
See also [`getScaleProps()`](#getscaleprops), [`showScaleX`](#showscalex) and [`showScaleY`](#showscaley).
|
|
1813
1823
|
|
|
1814
1824
|
### `setTheme()`
|
|
1815
1825
|
|
|
@@ -1820,52 +1830,71 @@ Sets the color theme for one or both analyzer channels.
|
|
|
1820
1830
|
**Syntax:**
|
|
1821
1831
|
|
|
1822
1832
|
```js
|
|
1823
|
-
|
|
1824
|
-
setTheme(
|
|
1825
|
-
setTheme(
|
|
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)
|
|
1826
1848
|
```
|
|
1827
1849
|
|
|
1828
|
-
Parameter | type
|
|
1829
|
-
|
|
1830
|
-
`
|
|
1831
|
-
`
|
|
1832
|
-
`
|
|
1833
|
-
`
|
|
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`
|
|
1834
1856
|
|
|
1835
1857
|
When passing arrays for `name` or `themeObject` you can assign different themes to each channel at once.
|
|
1836
|
-
When using a single `name` or `themeObject`, if `channel` is not specified, the same
|
|
1858
|
+
When using a single `name` or `themeObject`, if `channel` is not specified, the same settings will be applied to both channels.
|
|
1837
1859
|
|
|
1838
|
-
|
|
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.**
|
|
1839
1861
|
|
|
1840
1862
|
**Return value:** none (`undefined`).
|
|
1841
1863
|
|
|
1842
|
-
See also [`channelLayout`](#channellayout), [`registerTheme()`](#registertheme) and [`spreadGradient`](#spreadgradient).
|
|
1864
|
+
See also [`channelLayout`](#channellayout), [`registerTheme()`](#registertheme), [`setThemeModifiers()`](#setthememodifiers) and [`spreadGradient`](#spreadgradient).
|
|
1843
1865
|
|
|
1844
1866
|
### `setThemeModifiers()`
|
|
1845
1867
|
|
|
1868
|
+
*Available since v5.0.0*
|
|
1869
|
+
|
|
1870
|
+
Sets theme modifiers for one or both analyzer channels.
|
|
1871
|
+
|
|
1846
1872
|
**Syntax:**
|
|
1847
1873
|
|
|
1848
1874
|
```js
|
|
1849
|
-
setThemeModifiers()
|
|
1850
|
-
setThemeModifiers(
|
|
1851
|
-
setThemeModifiers(
|
|
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
|
|
1852
1879
|
```
|
|
1853
1880
|
|
|
1854
|
-
Parameter
|
|
1855
|
-
|
|
1856
|
-
`
|
|
1857
|
-
`
|
|
1858
|
-
`modifiersObject` | *object* | modifiers object, as returned by [`getThemeModifiers()`](#getthememodifiers)
|
|
1859
|
-
`channel` | *number* | *(optional)* channel to set (`0` = left, `1` = right)
|
|
1881
|
+
Parameter | type | description
|
|
1882
|
+
------------|----------|------------------
|
|
1883
|
+
`channel` | *number* | Channel index to set (`0` = left, `1` = right)
|
|
1884
|
+
`modifiers` | *object* | Modifiers object (see below)
|
|
1860
1885
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
`
|
|
1864
|
-
|
|
1886
|
+
**When called without arguments, resets modifiers to defaults on both channels. If only a channel is specified, resets on given channel only.**
|
|
1887
|
+
|
|
1888
|
+
`modifiers` object structure:
|
|
1889
|
+
|
|
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
|
|
1865
1894
|
|
|
1866
1895
|
**Return value:** none (`undefined`).
|
|
1867
1896
|
|
|
1868
|
-
See also [`
|
|
1897
|
+
See also [`getThemeModifiers()`](#getthememodifiers) and [`setTheme()`](#settheme).
|
|
1869
1898
|
|
|
1870
1899
|
### `start()`
|
|
1871
1900
|
|
|
@@ -1904,7 +1933,7 @@ toggleAnalyzer()
|
|
|
1904
1933
|
toggleAnalyzer(force)
|
|
1905
1934
|
```
|
|
1906
1935
|
|
|
1907
|
-
|
|
1936
|
+
Parameter | type | description
|
|
1908
1937
|
----------|------|------------
|
|
1909
1938
|
`force` | *boolean* | forces the desired state - `true` to start or `false` to stop the analyzer
|
|
1910
1939
|
|
|
@@ -1923,26 +1952,49 @@ You can set the [`fsElement`](#fselement-htmlelement-object) constructor option
|
|
|
1923
1952
|
|
|
1924
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.
|
|
1925
1954
|
|
|
1926
|
-
### `
|
|
1955
|
+
### `unregisterTheme()`
|
|
1927
1956
|
|
|
1928
1957
|
*Available since v5.0.0*
|
|
1929
1958
|
|
|
1930
|
-
|
|
1959
|
+
Unregisters a color theme.
|
|
1931
1960
|
|
|
1932
1961
|
**Syntax:**
|
|
1933
1962
|
|
|
1934
1963
|
```js
|
|
1935
|
-
|
|
1964
|
+
unregisterTheme(name)
|
|
1936
1965
|
```
|
|
1937
1966
|
|
|
1938
|
-
Parameter
|
|
1939
|
-
|
|
1940
|
-
`
|
|
1941
|
-
`channel` | *number* | *(optional)* desired channel (`0` = left, `1` = right) - **if not specified, toggles modifier on both channels**
|
|
1967
|
+
Parameter | type | description
|
|
1968
|
+
----------|----------|---------------
|
|
1969
|
+
`name` | *string* | Valid theme name. May include built-in themes. See [`getThemeList()`](#getthemelist).
|
|
1942
1970
|
|
|
1943
|
-
**Return value:**
|
|
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)
|
|
1944
1996
|
|
|
1945
|
-
|
|
1997
|
+
**Return value:** a *number*, representing the gain or attenuation (in dB) to be applied to the original amplitude value.
|
|
1946
1998
|
|
|
1947
1999
|
|
|
1948
2000
|
## Custom Errors
|
|
@@ -1953,11 +2005,11 @@ See also [`setThemeModifiers()`](#setthememodifiers) and [`setTheme()`](#setthem
|
|
|
1953
2005
|
|
|
1954
2006
|
The `code` property is a *number*. [Constants](#constants) are available to simplify checking for error codes.
|
|
1955
2007
|
|
|
1956
|
-
code | Constant | Error description
|
|
1957
|
-
|
|
1958
|
-
`1`
|
|
1959
|
-
`2`
|
|
1960
|
-
`3`
|
|
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*.
|
|
1961
2013
|
|
|
1962
2014
|
|
|
1963
2015
|
## Known Issues
|
|
@@ -1986,7 +2038,7 @@ The `import` statement must be inside a `script` which has the `type="module"` p
|
|
|
1986
2038
|
|
|
1987
2039
|
```html
|
|
1988
2040
|
<script type="module">
|
|
1989
|
-
import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@
|
|
2041
|
+
import AudioMotionAnalyzer from 'https://cdn.jsdelivr.net/npm/audiomotion-analyzer@beta/+esm';
|
|
1990
2042
|
|
|
1991
2043
|
// your code here
|
|
1992
2044
|
</script>
|