@grame/faustwasm 0.0.25
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 +181 -0
- package/assets/standalone/faust-ui/index.css +414 -0
- package/assets/standalone/faust-ui/index.css.map +1 -0
- package/assets/standalone/faust-ui/index.d.ts +1 -0
- package/assets/standalone/faust-ui/index.js +3478 -0
- package/assets/standalone/faust-ui/index.js.map +1 -0
- package/assets/standalone/faustwasm/index.d.ts +1252 -0
- package/assets/standalone/faustwasm/index.js +3772 -0
- package/assets/standalone/faustwasm/index.js.map +7 -0
- package/assets/standalone/index.html +73 -0
- package/assets/standalone/index.js +198 -0
- package/assets/standalone/types.d.ts +9 -0
- package/dist/cjs/index.d.ts +1252 -0
- package/dist/cjs/index.js +3752 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs-bundle/index.d.ts +1259 -0
- package/dist/cjs-bundle/index.js +11507 -0
- package/dist/cjs-bundle/index.js.map +7 -0
- package/dist/esm/index.d.ts +1252 -0
- package/dist/esm/index.js +3772 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm-bundle/index.d.ts +1259 -0
- package/dist/esm-bundle/index.js +11495 -0
- package/dist/esm-bundle/index.js.map +7 -0
- package/fileutils.js +40 -0
- package/libfaust-wasm/libfaust-wasm.d.cts +3 -0
- package/libfaust-wasm/libfaust-wasm.d.ts +3 -0
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.data.d.ts +2 -0
- package/libfaust-wasm/libfaust-wasm.js +21 -0
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/libfaust-wasm/libfaust-wasm.wasm.d.ts +2 -0
- package/library.md +91 -0
- package/package.json +43 -0
- package/postbuild-bundled.js +11 -0
- package/postbuild.js +63 -0
- package/prebuild-bundled.js +11 -0
- package/rsrc/overview.png +0 -0
- package/rsrc/overview.xlsx +0 -0
- package/scripts/faust2sndfile.js +43 -0
- package/scripts/faust2svg.js +17 -0
- package/scripts/faust2wasm.js +29 -0
- package/src/FaustAudioWorkletNode.ts +264 -0
- package/src/FaustAudioWorkletProcessor.ts +273 -0
- package/src/FaustCompiler.ts +252 -0
- package/src/FaustDspGenerator.ts +498 -0
- package/src/FaustDspInstance.ts +141 -0
- package/src/FaustFFTAudioWorkletProcessor.ts +554 -0
- package/src/FaustOfflineProcessor.ts +141 -0
- package/src/FaustScriptProcessorNode.ts +80 -0
- package/src/FaustSvgDiagrams.ts +37 -0
- package/src/FaustWasmInstantiator.ts +202 -0
- package/src/FaustWebAudioDsp.ts +1060 -0
- package/src/LibFaust.ts +57 -0
- package/src/WavDecoder.ts +207 -0
- package/src/WavEncoder.ts +204 -0
- package/src/copyWebStandaloneAssets.d.ts +3 -0
- package/src/copyWebStandaloneAssets.js +20 -0
- package/src/exports-bundle.ts +5 -0
- package/src/exports.ts +24 -0
- package/src/faust2svgFiles.d.ts +3 -0
- package/src/faust2svgFiles.js +43 -0
- package/src/faust2wasmFiles.d.ts +5 -0
- package/src/faust2wasmFiles.js +93 -0
- package/src/faust2wavFiles.d.ts +3 -0
- package/src/faust2wavFiles.js +58 -0
- package/src/index-bundle-iife.ts +7 -0
- package/src/index-bundle.ts +5 -0
- package/src/index.ts +5 -0
- package/src/instantiateFaustModule.ts +32 -0
- package/src/instantiateFaustModuleFromFile.ts +57 -0
- package/src/types.ts +234 -0
- package/test/clarinet.dsp +1 -0
- package/test/faustlive-wasm/faust-ui/index.css +414 -0
- package/test/faustlive-wasm/faust-ui/index.css.map +1 -0
- package/test/faustlive-wasm/faust-ui/index.d.ts +1 -0
- package/test/faustlive-wasm/faust-ui/index.js +3478 -0
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -0
- package/test/faustlive-wasm/faustwasm/index.d.ts +1252 -0
- package/test/faustlive-wasm/faustwasm/index.js +3772 -0
- package/test/faustlive-wasm/faustwasm/index.js.map +7 -0
- package/test/faustlive-wasm/index.css +97 -0
- package/test/faustlive-wasm/index.html +130 -0
- package/test/faustlive-wasm/index.js +638 -0
- package/test/guitar.dsp +1 -0
- package/test/guitar1.dsp +2 -0
- package/test/libfaust-in-worklet/index.html +13 -0
- package/test/libfaust-in-worklet/index.js +40 -0
- package/test/mono.dsp +8 -0
- package/test/node/test.js +17 -0
- package/test/noise.dsp +3 -0
- package/test/organ.dsp +5 -0
- package/test/organ1.dsp +6 -0
- package/test/osc.dsp +4 -0
- package/test/osc2.dsp +5 -0
- package/test/osc3.dsp +4 -0
- package/test/p-dj.dsp +4 -0
- package/test/poly.dsp +13 -0
- package/test/rev.dsp +2 -0
- package/test/t1.dsp +1 -0
- package/test/web/fft.html +87 -0
- package/test/web/fft1.html +88 -0
- package/test/web/fft2.html +114 -0
- package/test/web/fftw.js +1907 -0
- package/test/web/index.html +12 -0
- package/test/web/index.js +235 -0
- package/test/web/kissfft.js +904 -0
- package/test/web/mono.html +46 -0
- package/test/web/poly-key.html +62 -0
- package/test/web/poly.html +59 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<script src="../../dist/cjs-bundle/index.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body style="position: absolute; width: 100%; height: 100%; margin: 0px">
|
|
8
|
+
<button id="start">Start</button>
|
|
9
|
+
</body>
|
|
10
|
+
<script>
|
|
11
|
+
code = `
|
|
12
|
+
import("stdfaust.lib");
|
|
13
|
+
process = ba.pulsen(1, 10000) : pm.djembe(60, 0.3, 0.4, 1) <: dm.freeverb_demo;`;
|
|
14
|
+
let t0 = performance.now();
|
|
15
|
+
const time = (str) => {
|
|
16
|
+
const t = performance.now();
|
|
17
|
+
if (str) console.log(str, t - t0);
|
|
18
|
+
t0 = t;
|
|
19
|
+
}
|
|
20
|
+
const { instantiateFaustModule, LibFaust, FaustCompiler, FaustMonoDspGenerator } = faustwasm;
|
|
21
|
+
document.getElementById("start").onclick = async () => {
|
|
22
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
23
|
+
await audioCtx.resume();
|
|
24
|
+
time();
|
|
25
|
+
faustModule = await instantiateFaustModule();
|
|
26
|
+
time("Faust WASM Module ready");
|
|
27
|
+
libFaust = new LibFaust(faustModule);
|
|
28
|
+
compiler = new FaustCompiler(libFaust);
|
|
29
|
+
generator = new FaustMonoDspGenerator();
|
|
30
|
+
time("Faust DSP Generator ready");
|
|
31
|
+
await generator.compile(compiler, "dsp", code, "");
|
|
32
|
+
time("Faust DSP compiled");
|
|
33
|
+
node = await generator.createNode(audioCtx);
|
|
34
|
+
time("Faust AW Node generated");
|
|
35
|
+
node.connect(audioCtx.destination);
|
|
36
|
+
setTimeout(async () => {
|
|
37
|
+
node.disconnect();
|
|
38
|
+
time();
|
|
39
|
+
node1 = await generator.createNode(audioCtx, undefined, undefined, true);
|
|
40
|
+
time("Faust SP Node generated");
|
|
41
|
+
node1.connect(audioCtx.destination);
|
|
42
|
+
setTimeout(() => node1.disconnect(), 6000);
|
|
43
|
+
}, 6000);
|
|
44
|
+
};
|
|
45
|
+
</script>
|
|
46
|
+
</html>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<script src="../../dist/cjs-bundle/index.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body style="position: absolute; width: 100%; height: 100%; margin: 0px">
|
|
8
|
+
<button id="start">Start</button>
|
|
9
|
+
</body>
|
|
10
|
+
<script>
|
|
11
|
+
polycode = `
|
|
12
|
+
import("stdfaust.lib");
|
|
13
|
+
process = ba.pulsen(1, key * 1000) : pm.marimba(ba.midikey2hz(key + 2), 0, 7000, 0.5, 0.8) * (vel / 127) * gate
|
|
14
|
+
+ ba.pulsen(1, ba.hz2midikey(freq) * 1000) : pm.marimba(freq, 0, 7000, 0.5, 0.8) * gain * gate with {
|
|
15
|
+
key = hslider("key", 69, 40, 8000, 1);
|
|
16
|
+
freq = hslider("freq", 440, 40, 8000, 1);
|
|
17
|
+
vel = hslider("vel", 100, 0, 127, 1);
|
|
18
|
+
gain = hslider("gain", 0.5, 0, 1, 0.01);
|
|
19
|
+
gate = button("gate");
|
|
20
|
+
};
|
|
21
|
+
effect = dm.freeverb_demo;`;
|
|
22
|
+
const playNote = (node) => {
|
|
23
|
+
node.keyOn(0, 60, 100);
|
|
24
|
+
setTimeout(() => node.keyOn(0, 64, 40), 500);
|
|
25
|
+
setTimeout(() => node.keyOn(0, 67, 80), 1000);
|
|
26
|
+
setTimeout(() => node.keyOn(0, 68, 40), 500);
|
|
27
|
+
setTimeout(() => node.keyOn(0, 71, 80), 1000);
|
|
28
|
+
setTimeout(() => node.allNotesOff(), 5000);
|
|
29
|
+
};
|
|
30
|
+
let t0 = performance.now();
|
|
31
|
+
const time = (str) => {
|
|
32
|
+
const t = performance.now();
|
|
33
|
+
if (str) console.log(str, t - t0);
|
|
34
|
+
t0 = t;
|
|
35
|
+
}
|
|
36
|
+
const { instantiateFaustModule, LibFaust, FaustCompiler, FaustPolyDspGenerator } = faustwasm;
|
|
37
|
+
document.getElementById("start").onclick = async () => {
|
|
38
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
39
|
+
await audioCtx.resume();
|
|
40
|
+
time();
|
|
41
|
+
faustModule = await instantiateFaustModule();
|
|
42
|
+
time("Faust WASM Module ready");
|
|
43
|
+
libFaust = new LibFaust(faustModule);
|
|
44
|
+
compiler = new FaustCompiler(libFaust);
|
|
45
|
+
generator = new FaustPolyDspGenerator();
|
|
46
|
+
time("Faust DSP Generator ready");
|
|
47
|
+
await generator.compile(compiler, "dsp", polycode, "");
|
|
48
|
+
time("Faust DSP compiled");
|
|
49
|
+
node = await generator.createNode(audioCtx, 4);
|
|
50
|
+
time("Faust AW Node generated");
|
|
51
|
+
node.connect(audioCtx.destination);
|
|
52
|
+
playNote(node);
|
|
53
|
+
setTimeout(async () => {
|
|
54
|
+
time()
|
|
55
|
+
node1 = await generator.createNode(audioCtx, 4, undefined, undefined, undefined, undefined, true);
|
|
56
|
+
time("Faust SP Node generated");
|
|
57
|
+
node1.connect(audioCtx.destination);
|
|
58
|
+
playNote(node1);
|
|
59
|
+
}, 6000);
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
62
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<script src="../../dist/cjs-bundle/index.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body style="position: absolute; width: 100%; height: 100%; margin: 0px">
|
|
8
|
+
<button id="start">Start</button>
|
|
9
|
+
</body>
|
|
10
|
+
<script>
|
|
11
|
+
polycode = `
|
|
12
|
+
import("stdfaust.lib");
|
|
13
|
+
process = ba.pulsen(1, ba.hz2midikey(freq) * 1000) : pm.marimba(freq, 0, 7000, 0.5, 0.8) * gate * gain with {
|
|
14
|
+
freq = hslider("freq", 440, 40, 8000, 1);
|
|
15
|
+
gain = hslider("gain", 0.5, 0, 1, 0.01);
|
|
16
|
+
gate = button("gate");
|
|
17
|
+
};
|
|
18
|
+
effect = dm.freeverb_demo;`;
|
|
19
|
+
const playNote = (node) => {
|
|
20
|
+
node.keyOn(0, 60, 100);
|
|
21
|
+
setTimeout(() => node.keyOn(0, 64, 40), 500);
|
|
22
|
+
setTimeout(() => node.keyOn(0, 67, 80), 1000);
|
|
23
|
+
setTimeout(() => node.keyOn(0, 68, 40), 500);
|
|
24
|
+
setTimeout(() => node.keyOn(0, 71, 80), 1000);
|
|
25
|
+
setTimeout(() => node.allNotesOff(), 5000);
|
|
26
|
+
};
|
|
27
|
+
let t0 = performance.now();
|
|
28
|
+
const time = (str) => {
|
|
29
|
+
const t = performance.now();
|
|
30
|
+
if (str) console.log(str, t - t0);
|
|
31
|
+
t0 = t;
|
|
32
|
+
}
|
|
33
|
+
const { instantiateFaustModule, LibFaust, FaustCompiler, FaustPolyDspGenerator } = faustwasm;
|
|
34
|
+
document.getElementById("start").onclick = async () => {
|
|
35
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
36
|
+
await audioCtx.resume();
|
|
37
|
+
time();
|
|
38
|
+
faustModule = await instantiateFaustModule();
|
|
39
|
+
time("Faust WASM Module ready");
|
|
40
|
+
libFaust = new LibFaust(faustModule);
|
|
41
|
+
compiler = new FaustCompiler(libFaust);
|
|
42
|
+
generator = new FaustPolyDspGenerator();
|
|
43
|
+
time("Faust DSP Generator ready");
|
|
44
|
+
await generator.compile(compiler, "dsp", polycode, "");
|
|
45
|
+
time("Faust DSP compiled");
|
|
46
|
+
node = await generator.createNode(audioCtx, 4);
|
|
47
|
+
time("Faust AW Node generated");
|
|
48
|
+
node.connect(audioCtx.destination);
|
|
49
|
+
playNote(node);
|
|
50
|
+
setTimeout(async () => {
|
|
51
|
+
time();
|
|
52
|
+
node1 = await generator.createNode(audioCtx, 4, undefined, undefined, undefined, undefined, true);
|
|
53
|
+
time("Faust SP Node generated");
|
|
54
|
+
node1.connect(audioCtx.destination);
|
|
55
|
+
playNote(node1);
|
|
56
|
+
}, 6000);
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
</html>
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"checkJs": true,
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"target": "ES2019",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"strictNullChecks": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*"
|
|
14
|
+
],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"dist",
|
|
17
|
+
"node_modules",
|
|
18
|
+
"libfaust-wasm",
|
|
19
|
+
"test",
|
|
20
|
+
"assets"
|
|
21
|
+
]
|
|
22
|
+
}
|