node-web-audio-api 1.0.3 → 1.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.0.6 - 2025-11-18
4
+
5
+ - Fix `mjs` exports
6
+
7
+ ## v1.0.4 - 2025-03-20
8
+
9
+ - Fix parsing of parameterData for AudioWorkletNode
10
+
3
11
  ## v1.0.3 - 2025-03-06
4
12
 
5
13
  - Improve typescript support
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/node-web-audio-api.svg)](https://badge.fury.io/js/node-web-audio-api)
4
4
 
5
- Node.js bindings for the Rust implementation of the [Web Audio API](https://www.w3.org/TR/webaudio/).
5
+ Node.js bindings for the Rust implementation of the [Web Audio API specification](https://www.w3.org/TR/webaudio/).
6
6
 
7
- This library aims to provide an implementation that is both efficient and compliant with the specification.
7
+ The library aims to provide an implementation that is both efficient and compliant with the specification.
8
8
 
9
9
  - see [`orottier/web-audio-api-rs`](https://github.com/orottier/web-audio-api-rs/) for the "real" audio guts
10
10
  - use [`napi-rs`](https://github.com/napi-rs/napi-rs/) for the Node.js bindings
11
11
 
12
- For library authors who which to write components that run both in Node.js and the browser, we also provide [isomorphic-web-audio-api](https://github.com/ircam-ismm/isomorphic-web-audio-api)
12
+ For library authors who want to write components that run both in Node.js and the browser, we also provide [isomorphic-web-audio-api](https://github.com/ircam-ismm/isomorphic-web-audio-api).
13
13
 
14
14
  ## Install
15
15
 
@@ -69,6 +69,7 @@ node examples/granular-scrub.js
69
69
 
70
70
  - `AudioBuffer#getChannelData` is implemented but not reliable in some situations. Your should prefer `AudioBuffer#copyToChannel` and `AudioBuffer#copyFromChannel` when you want to access or manipulate the underlying samples in a safe way.
71
71
  - `Streams`: only a minimal audio input stream and the `MediaStreamSourceNode` are provided. All other `MediaStream` features are left on the side for now as they principally concern a different API specification, which is not a trivial problem.
72
+ - `new AudioContext({sinkId:{type:'none'}})`: if your system has no audio sinks (e.g. docker image) use `{sinkId:{type:'none'}}` when initializing `AudioContext`, else it will crash with `DeviceNotAvailable` [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext#sinkid)
72
73
 
73
74
  ## Supported Platforms - Prebuilt Binaries
74
75
 
package/index.mjs CHANGED
@@ -26,50 +26,46 @@ import {
26
26
  const require = createRequire(import.meta.url);
27
27
 
28
28
  const nativeModule = require('./index.cjs');
29
- export const {
30
- // events
31
- OfflineAudioCompletionEvent,
32
- AudioProcessingEvent,
33
- AudioRenderCapacityEvent,
29
+ // events
30
+ export const OfflineAudioCompletionEvent = nativeModule.OfflineAudioCompletionEvent;
31
+ export const AudioProcessingEvent = nativeModule.AudioProcessingEvent;
32
+ export const AudioRenderCapacityEvent = nativeModule.AudioRenderCapacityEvent;
33
+ // manually written nodes
34
+ export const BaseAudioContext = nativeModule.BaseAudioContext;
35
+ export const AudioContext = nativeModule.AudioContext;
36
+ export const OfflineAudioContext = nativeModule.OfflineAudioContext;
34
37
 
35
- // manually written nodes
36
- BaseAudioContext,
37
- AudioContext,
38
- OfflineAudioContext,
38
+ export const AudioNode = nativeModule.AudioNode;
39
+ export const AudioScheduledSourceNode = nativeModule.AudioScheduledSourceNode;
40
+ export const AudioParam = nativeModule.AudioParam;
41
+ export const AudioDestinationNode = nativeModule.AudioDestinationNode;
42
+ export const AudioListener = nativeModule.AudioListener;
43
+ export const AudioWorklet = nativeModule.AudioWorklet;
44
+ export const AudioParamMap = nativeModule.AudioParamMap;
45
+ export const AudioRenderCapacity = nativeModule.AudioRenderCapacity;
39
46
 
40
- AudioNode,
41
- AudioScheduledSourceNode,
42
- AudioParam,
43
- AudioDestinationNode,
44
- AudioListener,
45
- AudioWorklet,
46
- AudioParamMap,
47
- AudioRenderCapacity,
48
-
49
- PeriodicWave,
50
- AudioBuffer,
51
- // generated nodes
52
- ScriptProcessorNode,
53
- AudioWorkletNode,
54
- AnalyserNode,
55
- AudioBufferSourceNode,
56
- BiquadFilterNode,
57
- ChannelMergerNode,
58
- ChannelSplitterNode,
59
- ConstantSourceNode,
60
- ConvolverNode,
61
- DelayNode,
62
- DynamicsCompressorNode,
63
- GainNode,
64
- IIRFilterNode,
65
- MediaStreamAudioSourceNode,
66
- OscillatorNode,
67
- PannerNode,
68
- StereoPannerNode,
69
- WaveShaperNode,
70
-
71
- // helper methods
72
- mediaDevices,
73
- } = nativeModule;
47
+ export const PeriodicWave = nativeModule.PeriodicWave;
48
+ export const AudioBuffer = nativeModule.AudioBuffer;
49
+ // generated nodes
50
+ export const ScriptProcessorNode = nativeModule.ScriptProcessorNode;
51
+ export const AudioWorkletNode = nativeModule.AudioWorkletNode;
52
+ export const AnalyserNode = nativeModule.AnalyserNode;
53
+ export const AudioBufferSourceNode = nativeModule.AudioBufferSourceNode;
54
+ export const BiquadFilterNode = nativeModule.BiquadFilterNode;
55
+ export const ChannelMergerNode = nativeModule.ChannelMergerNode;
56
+ export const ChannelSplitterNode = nativeModule.ChannelSplitterNode;
57
+ export const ConstantSourceNode = nativeModule.ConstantSourceNode;
58
+ export const ConvolverNode = nativeModule.ConvolverNode;
59
+ export const DelayNode = nativeModule.DelayNode;
60
+ export const DynamicsCompressorNode = nativeModule.DynamicsCompressorNode;
61
+ export const GainNode = nativeModule.GainNode;
62
+ export const IIRFilterNode = nativeModule.IIRFilterNode;
63
+ export const MediaStreamAudioSourceNode = nativeModule.MediaStreamAudioSourceNode;
64
+ export const OscillatorNode = nativeModule.OscillatorNode;
65
+ export const PannerNode = nativeModule.PannerNode;
66
+ export const StereoPannerNode = nativeModule.StereoPannerNode;
67
+ export const WaveShaperNode = nativeModule.WaveShaperNode;
68
+ // helper methods
69
+ export const mediaDevices = nativeModule.mediaDevices;
74
70
 
75
71
  export default nativeModule;
@@ -114,7 +114,7 @@ module.exports = (jsExport, nativeBinding) => {
114
114
  if (typeof options.parameterData === 'object' && options.parameterData !== null) {
115
115
  parsedOptions.parameterData = {};
116
116
 
117
- for (let [key, value] in Object.entries(options.parameterData)) {
117
+ for (let [key, value] of Object.entries(options.parameterData)) {
118
118
  const parsedKey = conversions['DOMString'](key, {
119
119
  context: `Failed to construct 'AudioWorkletNode': Invalid 'parameterData' property from AudioWorkletNodeOptions: Invalid key (${key})`,
120
120
  });
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-web-audio-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.7",
4
4
  "author": "Benjamin Matuszewski",
5
5
  "description": "Web Audio API implementation for Node.js",
6
6
  "exports": {
@@ -42,7 +42,7 @@
42
42
  "check": "cargo fmt && cargo clippy",
43
43
  "generate": "node generator/index.mjs && cargo fmt",
44
44
  "lint": "npx eslint index.cjs index.mjs && npx eslint js/*.js && npx eslint examples/*.js",
45
- "preversion": "npm install && npm run generate",
45
+ "preversion": "npm install && npm run generate && npm run lint",
46
46
  "postversion": "cargo bump $npm_package_version && git commit -am \"v$npm_package_version\" && node .scripts/check-changelog.mjs",
47
47
  "test": "mocha tests/*.spec.mjs",
48
48
  "test:ci": "mocha tests/*.spec.mjs -- --ci",