node-web-audio-api 0.5.0 → 0.6.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/index.cjs +18 -0
- package/index.mjs +7 -0
- package/node-web-audio-api.darwin-arm64.node +0 -0
- package/node-web-audio-api.darwin-x64.node +0 -0
- package/node-web-audio-api.linux-arm-gnueabihf.node +0 -0
- package/node-web-audio-api.linux-x64-gnu.node +0 -0
- package/node-web-audio-api.win32-arm64-msvc.node +0 -0
- package/node-web-audio-api.win32-x64-msvc.node +0 -0
- package/package.json +9 -9
- package/simple-test.mjs +21 -16
- package/dummy.mjs +0 -19
package/index.cjs
CHANGED
|
@@ -93,5 +93,23 @@ nativeBinding.AudioContext = patchAudioContext(nativeBinding.AudioContext);
|
|
|
93
93
|
nativeBinding.OfflineAudioContext = patchOfflineAudioContext(nativeBinding.OfflineAudioContext);
|
|
94
94
|
nativeBinding.load = load;
|
|
95
95
|
|
|
96
|
+
// ------------------------------------------------------------------
|
|
97
|
+
// monkey patch proto media devices API
|
|
98
|
+
// @todo - review
|
|
99
|
+
// ------------------------------------------------------------------
|
|
100
|
+
class MediaStream extends nativeBinding.Microphone {};
|
|
101
|
+
// const Microphone = nativeBinding.Microphone;
|
|
102
|
+
nativeBinding.Microphone = null;
|
|
103
|
+
|
|
104
|
+
nativeBinding.mediaDevices = {}
|
|
105
|
+
nativeBinding.mediaDevices.getUserMedia = function getUserMedia(options) {
|
|
106
|
+
if (options && options.audio === true) {
|
|
107
|
+
const mic = new MediaStream();
|
|
108
|
+
return Promise.resolve(mic);
|
|
109
|
+
} else {
|
|
110
|
+
throw new NotSupportedError(`Only { audio: true } is currently supported`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
96
114
|
module.exports = nativeBinding;
|
|
97
115
|
|
package/index.mjs
CHANGED
|
@@ -17,21 +17,28 @@ export const {
|
|
|
17
17
|
OfflineAudioContext,
|
|
18
18
|
AudioBuffer,
|
|
19
19
|
PeriodicWave,
|
|
20
|
+
// manually written nodes
|
|
21
|
+
MediaStreamAudioSourceNode,
|
|
20
22
|
// generated supported nodes
|
|
23
|
+
AnalyserNode,
|
|
21
24
|
AudioBufferSourceNode,
|
|
22
25
|
BiquadFilterNode,
|
|
23
26
|
ChannelMergerNode,
|
|
24
27
|
ChannelSplitterNode,
|
|
25
28
|
ConstantSourceNode,
|
|
29
|
+
ConvolverNode,
|
|
26
30
|
DelayNode,
|
|
27
31
|
DynamicsCompressorNode,
|
|
28
32
|
GainNode,
|
|
29
33
|
IIRFilterNode,
|
|
30
34
|
OscillatorNode,
|
|
35
|
+
PannerNode,
|
|
31
36
|
StereoPannerNode,
|
|
32
37
|
WaveShaperNode,
|
|
38
|
+
|
|
33
39
|
// helper methods
|
|
34
40
|
load,
|
|
41
|
+
mediaDevices,
|
|
35
42
|
} = nativeModule;
|
|
36
43
|
|
|
37
44
|
export default nativeModule;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-web-audio-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Benjamin Matuszewski",
|
|
5
5
|
"description": "Node.js bindings for web-audio-api-rs using napi-rs",
|
|
6
6
|
"exports": {
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"postversion": "cargo bump $npm_package_version && git commit -am \"v$npm_package_version\""
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@ircam/eslint-config": "^1.
|
|
40
|
-
"@sindresorhus/slugify": "^2.1.
|
|
41
|
-
"camelcase": "^
|
|
42
|
-
"chalk": "^5.0
|
|
43
|
-
"dotenv": "^16.0.
|
|
44
|
-
"eslint": "^8.
|
|
39
|
+
"@ircam/eslint-config": "^1.3.0",
|
|
40
|
+
"@sindresorhus/slugify": "^2.1.1",
|
|
41
|
+
"camelcase": "^7.0.1",
|
|
42
|
+
"chalk": "^5.2.0",
|
|
43
|
+
"dotenv": "^16.0.3",
|
|
44
|
+
"eslint": "^8.32.0",
|
|
45
45
|
"node-ssh": "^13.0.0",
|
|
46
|
-
"octokit": "^2.0.
|
|
46
|
+
"octokit": "^2.0.11",
|
|
47
47
|
"ping": "^0.4.2",
|
|
48
48
|
"template-literal": "^1.0.4",
|
|
49
49
|
"waves-masters": "^2.3.1",
|
|
50
50
|
"webidl2": "^24.2.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@napi-rs/cli": "^2.
|
|
53
|
+
"@napi-rs/cli": "^2.14.3",
|
|
54
54
|
"@node-rs/helper": "^1.3.3"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/simple-test.mjs
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { AudioContext } from './index.mjs';
|
|
1
|
+
// import { AudioContext } from './index.mjs';
|
|
2
2
|
|
|
3
|
-
const audioContext = new AudioContext();
|
|
3
|
+
// const audioContext = new AudioContext();
|
|
4
4
|
|
|
5
|
-
setInterval(() => {
|
|
6
|
-
|
|
5
|
+
// setInterval(() => {
|
|
6
|
+
// const now = audioContext.currentTime;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
// const env = audioContext.createGain();
|
|
9
|
+
// env.connect(audioContext.destination);
|
|
10
|
+
// env.gain.value = 0;
|
|
11
|
+
// env.gain.setValueAtTime(0, now);
|
|
12
|
+
// env.gain.linearRampToValueAtTime(0.1, now + 0.02);
|
|
13
|
+
// env.gain.exponentialRampToValueAtTime(0.0001, now + 1);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, 100);
|
|
15
|
+
// const osc = audioContext.createOscillator();
|
|
16
|
+
// osc.frequency.value = 200 + Math.random() * 2800;
|
|
17
|
+
// osc.connect(env);
|
|
18
|
+
// osc.start(now);
|
|
19
|
+
// osc.stop(now + 1);
|
|
20
|
+
// }, 100);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
import { mediaDevices } from './index.mjs';
|
|
24
|
+
|
|
25
|
+
console.log(mediaDevices);
|
package/dummy.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AudioContext } from './index.mjs';
|
|
2
|
-
|
|
3
|
-
const audioContext = new AudioContext();
|
|
4
|
-
|
|
5
|
-
const now = audioContext.currentTime;
|
|
6
|
-
|
|
7
|
-
const gain = audioContext.createGain();
|
|
8
|
-
gain.gain.setValueAtTime(0, now);
|
|
9
|
-
gain.connect(audioContext.destination);
|
|
10
|
-
|
|
11
|
-
const src = audioContext.createOscillator();
|
|
12
|
-
src.connect(gain);
|
|
13
|
-
src.start();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gain.gain.setValueCurveAtTime(new Float32Array([0, 1, 0]), now + 1, 2);
|
|
17
|
-
// gain.gain.setValueCurveAtTime(new Float32Array([0, 1, 0]), now + 1, 2);
|
|
18
|
-
|
|
19
|
-
gain.gain.linear(new Float32Array([0, 1, 0]), now + 1, 2);
|