@grame/faustwasm 0.0.58 → 0.0.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -31,6 +31,7 @@ const faust2wasmFiles = async (inputFile, outputDir, argv = [], poly = false) =>
31
31
  const dspName = fileName.replace(/\.dsp$/, '');
32
32
 
33
33
  if (!argv.find(a => a === "-I")) argv.push("-I", "libraries/");
34
+ argv.push("-ftz", "2");
34
35
  const dspModulePath = path.join(outputDir, `${dspName}.wasm`);
35
36
  const dspMetaPath = path.join(outputDir, `${dspName}.json`);
36
37
  const effectModulePath = path.join(outputDir, `${dspName}_effect.wasm`);
@@ -58,7 +59,6 @@ const faust2wasmFiles = async (inputFile, outputDir, argv = [], poly = false) =>
58
59
  dspModule = voiceFactory.code;
59
60
  dspMeta = JSON.parse(voiceFactory.json);
60
61
  mixerModule = mixerBuffer;
61
-
62
62
  if (effectFactory) {
63
63
  effectModule = effectFactory.code;
64
64
  effectMeta = JSON.parse(effectFactory.json);
@@ -1,40 +1,40 @@
1
1
  //@ts-check
2
2
  const div = document.getElementById("log");
3
3
  const log = (/** @type {string} */str) => div.innerHTML += str.replace("\n", "<br />") + "<br />";
4
- const options = "-ftz 0";
4
+ const options = "-ftz 2";
5
5
 
6
6
  (async () => {
7
- const ctx = new AudioContext();
8
- globalThis.ctx = ctx;
9
- globalThis.faustModule = await faustwasm.instantiateFaustModule();
10
- const post = async () => {
11
- const {
12
- instantiateFaustModule,
13
- LibFaust,
14
- getFaustAudioWorkletProcessor,
15
- WavEncoder,
16
- FaustWasmInstantiator,
17
- FaustMonoDspGenerator,
18
- FaustPolyDspGenerator,
19
- FaustMonoWebAudioDsp,
20
- FaustOfflineProcessor,
21
- FaustCompiler,
22
- FaustSvgDiagrams
23
- } = faustwasm;
24
- const faustModule = await instantiateFaustModule();
25
- const code = `import("stdfaust.lib");
7
+ const ctx = new AudioContext();
8
+ globalThis.ctx = ctx;
9
+ globalThis.faustModule = await faustwasm.instantiateFaustModule();
10
+ const post = async () => {
11
+ const {
12
+ instantiateFaustModule,
13
+ LibFaust,
14
+ getFaustAudioWorkletProcessor,
15
+ WavEncoder,
16
+ FaustWasmInstantiator,
17
+ FaustMonoDspGenerator,
18
+ FaustPolyDspGenerator,
19
+ FaustMonoWebAudioDsp,
20
+ FaustOfflineProcessor,
21
+ FaustCompiler,
22
+ FaustSvgDiagrams
23
+ } = faustwasm;
24
+ const faustModule = await instantiateFaustModule();
25
+ const code = `import("stdfaust.lib");
26
26
  process = os.osc(440);`;
27
- const gen = new FaustMonoDspGenerator();
28
- const libFaust = new LibFaust(faustModule);
29
- const compiler = new FaustCompiler(libFaust);
30
- console.log(compiler.version());
31
- await gen.compile(compiler, 'dsp', code, "-ftz 0");
32
-
33
- console.log(await gen.createAudioWorkletProcessor());
34
- const processor = await gen.createOfflineProcessor(48000, 128);
35
- console.log(processor);
36
- console.log(processor.render([], 48000));
37
- };
38
- await ctx.audioWorklet.addModule("../../dist/cjs-bundle/index.js");
39
- await ctx.audioWorklet.addModule(URL.createObjectURL(new Blob([`(${post.toString()})()`], { type: "application/javascript" })));
27
+ const gen = new FaustMonoDspGenerator();
28
+ const libFaust = new LibFaust(faustModule);
29
+ const compiler = new FaustCompiler(libFaust);
30
+ console.log(compiler.version());
31
+ await gen.compile(compiler, 'dsp', code, "-ftz 0");
32
+
33
+ console.log(await gen.createAudioWorkletProcessor());
34
+ const processor = await gen.createOfflineProcessor(48000, 128);
35
+ console.log(processor);
36
+ console.log(processor.render([], 48000));
37
+ };
38
+ await ctx.audioWorklet.addModule("../../dist/cjs-bundle/index.js");
39
+ await ctx.audioWorklet.addModule(URL.createObjectURL(new Blob([`(${post.toString()})()`], { type: "application/javascript" })));
40
40
  })();
package/test/node/test.js CHANGED
@@ -11,7 +11,6 @@ const wasmBuf = fs.readFileSync(path.join(__dirname, "../../libfaust-wasm/libfau
11
11
  (async () => {
12
12
  // const w = await WebAssembly.instantiate(wasmBuf, {env:{},wasi_snapshot_preview1:{}});
13
13
  // console.log(w);
14
-
15
14
  const faustModule = await FaustWasm.instantiateFaustModuleFromFile(path.join(__dirname, "../../libfaust-wasm/libfaust-wasm.js"));
16
15
  console.log(faustModule);
17
16
  })();
package/test/web/index.js CHANGED
@@ -2,234 +2,234 @@
2
2
  const div = document.getElementById("log");
3
3
  const log = (/** @type {string} */str) => div.innerHTML += str.replace("\n", "<br />") + "<br />";
4
4
  const svg = (/** @type {string} */str, /** @type {string} */name) => log(str);
5
- const options = "-ftz 0 -I libraries/";
5
+ const options = "-ftz 2 -I libraries/";
6
6
  const errCode = "foo";
7
7
  const effectCode = 'process = _*(hslider("Left", 0.1, 0, 1, 0.01)), _*(hslider("Right", 0.0, 0, 1, 0.01));';
8
8
 
9
9
 
10
10
  (async () => {
11
- const {
12
- instantiateFaustModule,
13
- LibFaust,
14
- WavEncoder,
15
- FaustWasmInstantiator,
16
- FaustMonoDspGenerator,
17
- FaustPolyDspGenerator,
18
- FaustMonoWebAudioDsp,
19
- FaustOfflineProcessor,
20
- FaustCompiler,
21
- FaustSvgDiagrams
22
- } = await import("../../dist/esm-bundle/index.js");
11
+ const {
12
+ instantiateFaustModule,
13
+ LibFaust,
14
+ WavEncoder,
15
+ FaustWasmInstantiator,
16
+ FaustMonoDspGenerator,
17
+ FaustPolyDspGenerator,
18
+ FaustMonoWebAudioDsp,
19
+ FaustOfflineProcessor,
20
+ FaustCompiler,
21
+ FaustSvgDiagrams
22
+ } = await import("../../dist/esm-bundle/index.js");
23
23
  const faustModule = await instantiateFaustModule();
24
24
 
25
25
  const libFaust = new LibFaust(faustModule);
26
- globalThis.libFaust = libFaust;
27
-
28
- /**
29
- * @param {InstanceType<FaustCompiler>} faust
30
- * @param {(msg: string) => any} log
31
- * @param {string} code
32
- */
33
- const misc = (faust, log, code) => {
34
- let exp;
35
- try {
36
- exp = faust.expandDSP(code, options);
37
- } catch (e) {
38
- log(" expandDSP " + exp || e.message);
39
- }
40
-
41
- let res;
42
- try {
43
- res = faust.generateAuxFiles("test", code, options + " -svg");
44
- } catch (e) {
45
- log(" generateAuxFiles " + res ? "done" : e.message);
46
- }
47
- }
48
- /**
49
- * @param {InstanceType<FaustCompiler>} faust
50
- * @param {(msg: string) => any} log
51
- * @param {string} code
52
- */
53
- const createDsp = async (faust, log, code) => {
54
- log("createMonoDSPFactory: ");
55
- let factory = await faust.createMonoDSPFactory("test", code, options);
56
- if (factory) {
57
- log("factory JSON: " + factory.json);
58
- log("factory poly: " + factory.poly);
59
- } else {
60
- log("factory is null");
61
- return;
62
- }
63
- log("deleteDSPFactory");
64
- faust.deleteDSPFactory(factory);
65
-
66
- log("createSyncMonoDSPInstance: ");
67
- let instance1 = FaustWasmInstantiator.createSyncMonoDSPInstance(factory);
68
- if (instance1) {
69
- log(" getNumInputs : " + instance1.api.getNumInputs(0));
70
- log(" getNumOutputs: " + instance1.api.getNumOutputs(0));
71
- log(" JSON: " + instance1.json);
72
- } else {
73
- log("instance1 is null");
74
- }
75
-
76
- log("createAsyncMonoDSPInstance: ");
77
- let instance2 = await FaustWasmInstantiator.createAsyncMonoDSPInstance(factory);
78
- if (instance2) {
79
- log(" getNumInputs : " + instance2.api.getNumInputs(0));
80
- log(" getNumOutputs: " + instance2.api.getNumOutputs(0));
81
- log(" JSON: " + instance2.json);
82
- } else {
83
- log("instance2 is null");
84
- }
85
- }
86
- /**
87
- * @param {InstanceType<FaustCompiler>} faust
88
- * @param {(msg: string) => any} log
89
- * @param {string} voiceCode
90
- * @param {string} effectCode
91
- */
92
- const createPolyDsp = async (faust, log, voiceCode, effectCode) => {
93
- const { mixerModule } = await faust.getAsyncInternalMixerModule();
94
- log("createPolyDSPFactory for voice: ");
95
- let voiceFactory = await faust.createPolyDSPFactory("voice", voiceCode, options);
96
- if (voiceFactory) {
97
- log("voice factory JSON: " + voiceFactory.json);
98
- log("voice factory poly: " + voiceFactory.poly);
99
- } else {
100
- log("voice_factory is null");
101
- return;
102
- }
103
- log("createPolyDSPFactory for effect: ");
104
- let effectFactory = await faust.createPolyDSPFactory("effect", effectCode, options);
105
- if (effectFactory) {
106
- log("effect factory JSON: " + effectFactory.json);
107
- log("effect factory poly: " + effectFactory.poly);
108
- } else {
109
- log("effect_factory is null");
110
- }
111
-
112
- log("createSyncPolyDSPInstance: ");
113
- let polyInstance1 = FaustWasmInstantiator.createSyncPolyDSPInstance(voiceFactory, mixerModule, 8, effectFactory);
114
- if (polyInstance1) {
115
- log(" voice_api getNumInputs : " + polyInstance1.voiceAPI.getNumInputs(0));
116
- log(" voice_api getNumOutputs: " + polyInstance1.voiceAPI.getNumOutputs(0));
117
- log(" JSON: " + polyInstance1.voiceJSON);
118
- log(" effect_api getNumInputs : " + polyInstance1.voiceAPI.getNumInputs(0));
119
- log(" effect_api getNumOutputs: " + polyInstance1.voiceAPI.getNumOutputs(0));
120
- log(" JSON: " + polyInstance1.effectJSON);
121
- } else {
122
- log("poly_instance1 is null");
123
- }
124
-
125
- log("createAsyncPolyDSPInstance: ");
126
- let polyInstance2 = await FaustWasmInstantiator.createAsyncPolyDSPInstance(voiceFactory, mixerModule, 8, effectFactory);
127
- if (polyInstance2) {
128
- log(" voice_api getNumInputs : " + polyInstance2.voiceAPI.getNumInputs(0));
129
- log(" voice_api getNumOutputs: " + polyInstance2.voiceAPI.getNumOutputs(0));
130
- log(" JSON: " + polyInstance2.voiceJSON);
131
- log(" effect_api getNumInputs : " + polyInstance2.effectAPI.getNumInputs(0));
132
- log(" effect_api getNumOutputs: " + polyInstance2.effectAPI.getNumOutputs(0));
133
- log(" JSON: " + polyInstance2.effectJSON);
134
- } else {
135
- log("poly_instance2 is null");
136
- }
137
- }
138
-
139
- /**
140
- * @param {InstanceType<FaustCompiler>} compiler
141
- * @param {(msg: string) => any} log
142
- * @param {string} code
143
- */
144
- const svgdiagrams = (compiler, log, code) => {
145
- const filter = "import(\"stdfaust.lib\");\nprocess = dm.oscrs_demo;";
146
- const SvgDiagrams = new FaustSvgDiagrams(compiler);
147
-
148
- let svg1 = SvgDiagrams.from("TestSVG1", code, options);
149
- log(`<div>${svg1["process.svg"]}</div>`);
150
-
151
- let svg2 = SvgDiagrams.from("TestSVG2", filter, options)
152
- log(`<div>${svg2["process.svg"]}</div>`);
153
- }
154
-
155
- /**
156
- * @param {InstanceType<FaustCompiler>} faust
157
- * @param {(msg: string) => any} log
158
- */
159
- const offlineProcessor = async (faust, log) => {
160
-
161
- let signal = "import(\"stdfaust.lib\");\nprocess = 0.25,0.33, 0.6;";
162
- let factory = await faust.createMonoDSPFactory("test", signal, options);
163
- const instance = await FaustWasmInstantiator.createAsyncMonoDSPInstance(factory);
164
- const dsp = new FaustMonoWebAudioDsp(instance, 48000, 4, 33);
165
-
166
- log("offlineProcessor");
167
- let offline = new FaustOfflineProcessor(dsp, 33);
168
- let plotted = offline.render(null, 100);
169
- for (let chan = 0; chan < plotted.length; chan++) {
170
- for (let frame = 0; frame < 100; frame++) {
171
- console.log("Chan %d sample %f\n", chan, plotted[chan][frame])
172
- }
173
- }
174
- }
175
- /**
176
- *
177
- * @param {InstanceType<LibFaust>} libFaust
178
- * @param {(msg: string) => any} log
179
- * @param {string} code
180
- * @param {AudioContext} context
181
- */
182
- const run = async (libFaust, log, code, context) => {
183
- const compiler = new FaustCompiler(libFaust);
184
- log("libfaust version: " + compiler.version());
185
-
186
- log("\n-----------------\nMisc tests" + compiler.version());
187
- misc(compiler, log, code);
188
- log("\n-----------------\nMisc tests with error code");
189
- misc(compiler, log, errCode);
190
-
191
- log("\n-----------------\nCreating DSP instance:");
192
- await createDsp(compiler, log, code);
193
-
194
- log("\n-----------------\nCreating Poly DSP instance:");
195
- await createPolyDsp(compiler, log, code, effectCode);
196
-
197
- log("\n-----------------\nCreating DSP instance with error code:");
198
- await createDsp(compiler, log, errCode).catch(e => { log(e.message); });
199
-
200
- log("\n-----------------\nCreating Poly DSP instance with error code:");
201
- await createPolyDsp(compiler, log, errCode, effectCode).catch(e => { log(e.message); });
202
-
203
- log("\n-----------------\nTest SVG diagrams: ");
204
- svgdiagrams(compiler, log, code);
205
-
206
- log("\n-----------------\nTest Offline processor ");
207
- offlineProcessor(compiler, log);
208
-
209
- const gen = new FaustPolyDspGenerator()
210
- await gen.compile(compiler, "mydsp2", code, options, effectCode);
211
- const node = await gen.createNode(ctx, 8);
212
- console.log(node);
213
- console.log(node.getParams());
214
- console.log(node.getMeta());
215
- node.connect(ctx.destination);
216
- node.keyOn(0, 60, 50);
217
- node.keyOn(0, 64, 50);
218
- node.keyOn(0, 67, 50);
219
- node.keyOn(0, 71, 50);
220
- node.keyOn(0, 76, 50);
221
-
222
- log("\nEnd of API tests");
223
- };
26
+ globalThis.libFaust = libFaust;
27
+
28
+ /**
29
+ * @param {InstanceType<FaustCompiler>} faust
30
+ * @param {(msg: string) => any} log
31
+ * @param {string} code
32
+ */
33
+ const misc = (faust, log, code) => {
34
+ let exp;
35
+ try {
36
+ exp = faust.expandDSP(code, options);
37
+ } catch (e) {
38
+ log(" expandDSP " + exp || e.message);
39
+ }
40
+
41
+ let res;
42
+ try {
43
+ res = faust.generateAuxFiles("test", code, options + " -svg");
44
+ } catch (e) {
45
+ log(" generateAuxFiles " + res ? "done" : e.message);
46
+ }
47
+ }
48
+ /**
49
+ * @param {InstanceType<FaustCompiler>} faust
50
+ * @param {(msg: string) => any} log
51
+ * @param {string} code
52
+ */
53
+ const createDsp = async (faust, log, code) => {
54
+ log("createMonoDSPFactory: ");
55
+ let factory = await faust.createMonoDSPFactory("test", code, options);
56
+ if (factory) {
57
+ log("factory JSON: " + factory.json);
58
+ log("factory poly: " + factory.poly);
59
+ } else {
60
+ log("factory is null");
61
+ return;
62
+ }
63
+ log("deleteDSPFactory");
64
+ faust.deleteDSPFactory(factory);
65
+
66
+ log("createSyncMonoDSPInstance: ");
67
+ let instance1 = FaustWasmInstantiator.createSyncMonoDSPInstance(factory);
68
+ if (instance1) {
69
+ log(" getNumInputs : " + instance1.api.getNumInputs(0));
70
+ log(" getNumOutputs: " + instance1.api.getNumOutputs(0));
71
+ log(" JSON: " + instance1.json);
72
+ } else {
73
+ log("instance1 is null");
74
+ }
75
+
76
+ log("createAsyncMonoDSPInstance: ");
77
+ let instance2 = await FaustWasmInstantiator.createAsyncMonoDSPInstance(factory);
78
+ if (instance2) {
79
+ log(" getNumInputs : " + instance2.api.getNumInputs(0));
80
+ log(" getNumOutputs: " + instance2.api.getNumOutputs(0));
81
+ log(" JSON: " + instance2.json);
82
+ } else {
83
+ log("instance2 is null");
84
+ }
85
+ }
86
+ /**
87
+ * @param {InstanceType<FaustCompiler>} faust
88
+ * @param {(msg: string) => any} log
89
+ * @param {string} voiceCode
90
+ * @param {string} effectCode
91
+ */
92
+ const createPolyDsp = async (faust, log, voiceCode, effectCode) => {
93
+ const { mixerModule } = await faust.getAsyncInternalMixerModule();
94
+ log("createPolyDSPFactory for voice: ");
95
+ let voiceFactory = await faust.createPolyDSPFactory("voice", voiceCode, options);
96
+ if (voiceFactory) {
97
+ log("voice factory JSON: " + voiceFactory.json);
98
+ log("voice factory poly: " + voiceFactory.poly);
99
+ } else {
100
+ log("voice_factory is null");
101
+ return;
102
+ }
103
+ log("createPolyDSPFactory for effect: ");
104
+ let effectFactory = await faust.createPolyDSPFactory("effect", effectCode, options);
105
+ if (effectFactory) {
106
+ log("effect factory JSON: " + effectFactory.json);
107
+ log("effect factory poly: " + effectFactory.poly);
108
+ } else {
109
+ log("effect_factory is null");
110
+ }
111
+
112
+ log("createSyncPolyDSPInstance: ");
113
+ let polyInstance1 = FaustWasmInstantiator.createSyncPolyDSPInstance(voiceFactory, mixerModule, 8, effectFactory);
114
+ if (polyInstance1) {
115
+ log(" voice_api getNumInputs : " + polyInstance1.voiceAPI.getNumInputs(0));
116
+ log(" voice_api getNumOutputs: " + polyInstance1.voiceAPI.getNumOutputs(0));
117
+ log(" JSON: " + polyInstance1.voiceJSON);
118
+ log(" effect_api getNumInputs : " + polyInstance1.voiceAPI.getNumInputs(0));
119
+ log(" effect_api getNumOutputs: " + polyInstance1.voiceAPI.getNumOutputs(0));
120
+ log(" JSON: " + polyInstance1.effectJSON);
121
+ } else {
122
+ log("poly_instance1 is null");
123
+ }
124
+
125
+ log("createAsyncPolyDSPInstance: ");
126
+ let polyInstance2 = await FaustWasmInstantiator.createAsyncPolyDSPInstance(voiceFactory, mixerModule, 8, effectFactory);
127
+ if (polyInstance2) {
128
+ log(" voice_api getNumInputs : " + polyInstance2.voiceAPI.getNumInputs(0));
129
+ log(" voice_api getNumOutputs: " + polyInstance2.voiceAPI.getNumOutputs(0));
130
+ log(" JSON: " + polyInstance2.voiceJSON);
131
+ log(" effect_api getNumInputs : " + polyInstance2.effectAPI.getNumInputs(0));
132
+ log(" effect_api getNumOutputs: " + polyInstance2.effectAPI.getNumOutputs(0));
133
+ log(" JSON: " + polyInstance2.effectJSON);
134
+ } else {
135
+ log("poly_instance2 is null");
136
+ }
137
+ }
138
+
139
+ /**
140
+ * @param {InstanceType<FaustCompiler>} compiler
141
+ * @param {(msg: string) => any} log
142
+ * @param {string} code
143
+ */
144
+ const svgdiagrams = (compiler, log, code) => {
145
+ const filter = "import(\"stdfaust.lib\");\nprocess = dm.oscrs_demo;";
146
+ const SvgDiagrams = new FaustSvgDiagrams(compiler);
147
+
148
+ let svg1 = SvgDiagrams.from("TestSVG1", code, options);
149
+ log(`<div>${svg1["process.svg"]}</div>`);
150
+
151
+ let svg2 = SvgDiagrams.from("TestSVG2", filter, options)
152
+ log(`<div>${svg2["process.svg"]}</div>`);
153
+ }
154
+
155
+ /**
156
+ * @param {InstanceType<FaustCompiler>} faust
157
+ * @param {(msg: string) => any} log
158
+ */
159
+ const offlineProcessor = async (faust, log) => {
160
+
161
+ let signal = "import(\"stdfaust.lib\");\nprocess = 0.25,0.33, 0.6;";
162
+ let factory = await faust.createMonoDSPFactory("test", signal, options);
163
+ const instance = await FaustWasmInstantiator.createAsyncMonoDSPInstance(factory);
164
+ const dsp = new FaustMonoWebAudioDsp(instance, 48000, 4, 33);
165
+
166
+ log("offlineProcessor");
167
+ let offline = new FaustOfflineProcessor(dsp, 33);
168
+ let plotted = offline.render(null, 100);
169
+ for (let chan = 0; chan < plotted.length; chan++) {
170
+ for (let frame = 0; frame < 100; frame++) {
171
+ console.log("Chan %d sample %f\n", chan, plotted[chan][frame])
172
+ }
173
+ }
174
+ }
175
+ /**
176
+ *
177
+ * @param {InstanceType<LibFaust>} libFaust
178
+ * @param {(msg: string) => any} log
179
+ * @param {string} code
180
+ * @param {AudioContext} context
181
+ */
182
+ const run = async (libFaust, log, code, context) => {
183
+ const compiler = new FaustCompiler(libFaust);
184
+ log("libfaust version: " + compiler.version());
185
+
186
+ log("\n-----------------\nMisc tests" + compiler.version());
187
+ misc(compiler, log, code);
188
+ log("\n-----------------\nMisc tests with error code");
189
+ misc(compiler, log, errCode);
190
+
191
+ log("\n-----------------\nCreating DSP instance:");
192
+ await createDsp(compiler, log, code);
193
+
194
+ log("\n-----------------\nCreating Poly DSP instance:");
195
+ await createPolyDsp(compiler, log, code, effectCode);
196
+
197
+ log("\n-----------------\nCreating DSP instance with error code:");
198
+ await createDsp(compiler, log, errCode).catch(e => { log(e.message); });
199
+
200
+ log("\n-----------------\nCreating Poly DSP instance with error code:");
201
+ await createPolyDsp(compiler, log, errCode, effectCode).catch(e => { log(e.message); });
202
+
203
+ log("\n-----------------\nTest SVG diagrams: ");
204
+ svgdiagrams(compiler, log, code);
205
+
206
+ log("\n-----------------\nTest Offline processor ");
207
+ offlineProcessor(compiler, log);
208
+
209
+ const gen = new FaustPolyDspGenerator()
210
+ await gen.compile(compiler, "mydsp2", code, options, effectCode);
211
+ const node = await gen.createNode(ctx, 8);
212
+ console.log(node);
213
+ console.log(node.getParams());
214
+ console.log(node.getMeta());
215
+ node.connect(ctx.destination);
216
+ node.keyOn(0, 60, 50);
217
+ node.keyOn(0, 64, 50);
218
+ node.keyOn(0, 67, 50);
219
+ node.keyOn(0, 71, 50);
220
+ node.keyOn(0, 76, 50);
221
+
222
+ log("\nEnd of API tests");
223
+ };
224
224
  const sampleRate = 48000;
225
- const code1Fetch = await fetch("../organ.dsp");
225
+ const code1Fetch = await fetch("../organ.dsp");
226
226
  const code1 = await code1Fetch.text();
227
- const name1 = "pdj";
228
- const code2Fetch = await fetch("../rev.dsp");
227
+ const name1 = "pdj";
228
+ const code2Fetch = await fetch("../rev.dsp");
229
229
  const code2 = await code2Fetch.text();
230
230
 
231
- const ctx = new AudioContext();
231
+ const ctx = new AudioContext();
232
232
 
233
- await run(libFaust, log, code1, ctx);
234
- globalThis.ctx = ctx;
233
+ await run(libFaust, log, code1, ctx);
234
+ globalThis.ctx = ctx;
235
235
  })();
package/test/bug/bug.html DELETED
@@ -1,84 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
- <title>Faust DSP</title>
9
- <style>
10
- body {
11
- color: #b0b0b0;
12
- background-color: #1f1f1f;
13
- display: flex;
14
- top: 0;
15
- left: 0;
16
- width: 100%;
17
- height: 100%;
18
- margin: 0;
19
- position: absolute;
20
- }
21
-
22
- main {
23
- margin: 20px;
24
- display: flex;
25
- flex-direction: column;
26
- flex: 1 1 100%;
27
- }
28
-
29
- main span {
30
- position: relative;
31
- display: flex;
32
- }
33
-
34
- main span[hidden] {
35
- display: none;
36
- }
37
-
38
- main span span {
39
- margin: 0px 10px;
40
- flex: 1;
41
- }
42
-
43
- main span select {
44
- flex: 2;
45
- }
46
-
47
- #dsp-switch {
48
- margin: 20px auto;
49
- }
50
-
51
- #button-dsp {
52
- padding: 10px;
53
- }
54
-
55
- #div-faust-ui {
56
- flex: 1 1 auto;
57
- display: flex;
58
- position: relative;
59
- flex-direction: column;
60
- }
61
- </style>
62
- <link rel="stylesheet" href="./faust-ui/index.css">
63
- </head>
64
-
65
- <body>
66
- <main>
67
- <span id="audio-input">
68
- <span>Select Audio Input Device</span>
69
- <select id="select-audio-input"></select>
70
- </span>
71
- <span id="midi-input">
72
- <span>Select MIDI Input Device</span>
73
- <select id="select-midi-input"></select>
74
- </span>
75
- <span id="dsp-switch">
76
- <button id="button-dsp">Activate DSP</button>
77
- </span>
78
- <div id="div-faust-ui">
79
- </div>
80
- </main>
81
- <script src="./bug.js"></script>
82
- </body>
83
-
84
- </html>