@grame/faustwasm 0.7.0 → 0.7.3
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/assets/standalone/create-node.js +5 -3
- package/assets/standalone/faustwasm/index.d.ts +4 -4
- package/assets/standalone/faustwasm/index.js +18 -11
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/assets/standalone/index-pwa.js +1 -1
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +18 -11
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +4 -4
- package/dist/cjs-bundle/index.js +20 -13
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +18 -11
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +4 -4
- package/dist/esm-bundle/index.js +20 -13
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustScriptProcessorNode.ts +26 -16
- package/src/FaustWebAudioDsp.ts +2 -2
- package/test/faustlive-wasm/faustwasm/index.d.ts +4 -4
- package/test/faustlive-wasm/faustwasm/index.js +18 -11
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/faustlive-wasm/index.js +2 -1
- package/test/tables.dsp +0 -71
|
@@ -471,6 +471,7 @@ const deleteDSP = () => {
|
|
|
471
471
|
audio_input.disconnect(DSP);
|
|
472
472
|
}
|
|
473
473
|
DSP.disconnect(audio_context.destination);
|
|
474
|
+
DSP.stopSensors();
|
|
474
475
|
DSP.destroy();
|
|
475
476
|
faustUIRoot.innerHTML = "";
|
|
476
477
|
DSP = null;
|
|
@@ -520,7 +521,7 @@ const activatePolyDSP = (dsp) => {
|
|
|
520
521
|
}
|
|
521
522
|
|
|
522
523
|
// Setup UI
|
|
523
|
-
DSP.
|
|
524
|
+
DSP.startSensors();
|
|
524
525
|
faustUI = new FaustUI({ ui: DSP.getUI(), root: faustUIRoot });
|
|
525
526
|
faustUI.paramChangeByUI = (path, value) => DSP.setParamValue(path, value);
|
|
526
527
|
DSP.setOutputParamHandler(output_handler);
|
package/test/tables.dsp
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import("stdfaust.lib");
|
|
2
|
-
|
|
3
|
-
wavetable(sf, pct) = it.lagrangeN(N, f_idx, par(i, N + 1, table(i_idx - int(N / 2) + i)))
|
|
4
|
-
with {
|
|
5
|
-
N = 3; // lagrange order
|
|
6
|
-
SFC = outputs(sf);
|
|
7
|
-
S = 0, 0 : sf : ba.selector(0, SFC); // table size
|
|
8
|
-
table(j) = int(ma.modulo(j, S)) : sf(0) : !, !, si.bus(SFC-2);
|
|
9
|
-
idx = S*pct;
|
|
10
|
-
f_idx = ma.frac(idx) + int(N / 2);
|
|
11
|
-
i_idx = int(idx);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
TABLE_SIZE = 2048;
|
|
15
|
-
NUM_LEVELS = 4;
|
|
16
|
-
|
|
17
|
-
aa_wavetable_level(sf, LEVEL, pct) = it.lagrangeN(N, f_idx, par(i, N + 1, table(i_idx - int(N / 2) + i)))
|
|
18
|
-
with {
|
|
19
|
-
S = TABLE_SIZE>>LEVEL;
|
|
20
|
-
r0 = int(0);
|
|
21
|
-
r1 = int(S-1);
|
|
22
|
-
|
|
23
|
-
mipped_table(x) = ba.tabulate(0, FX, S, r0, r1, x).val
|
|
24
|
-
with {
|
|
25
|
-
// require 1 channel out due to ba.tabulate
|
|
26
|
-
read_table(i) = sf(0, i) : !, !, _;
|
|
27
|
-
|
|
28
|
-
// simple average of me plus LEVEL neighbors to the right
|
|
29
|
-
FX(i) = sum(j, LEVEL+1, read_table(i*(LEVEL+1)+j))/(LEVEL+1);
|
|
30
|
-
};
|
|
31
|
-
table(j) = int(ma.modulo(j, S)) : mipped_table;
|
|
32
|
-
idx = S*pct;
|
|
33
|
-
N = 1; // lagrange order
|
|
34
|
-
f_idx = ma.frac(idx) + int(N / 2);
|
|
35
|
-
i_idx = int(idx);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
aa_wavetable(sf, freq, pct) = si.vecOp((tmp_wavetables, coeff), *) :> _
|
|
39
|
-
with {
|
|
40
|
-
// todo: fiddle with best remap values.
|
|
41
|
-
level_pos = ba.hz2midikey(freq) : it.remap(24, 36, 0, 1) : aa.clip(0, 1) / NUM_LEVELS;
|
|
42
|
-
tmp_wavetables = pct <: par(level, NUM_LEVELS, aa_wavetable_level(sf(level), level));
|
|
43
|
-
coeff = par(i, NUM_LEVELS, max(0, 1-abs(i-level_pos*(NUM_LEVELS-1))));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// mathematical hard-syncing phasor (see `phasor_imp` in `faustlibraries/oscillators.lib`)
|
|
47
|
-
m_hsp_phasor(freq, reset, phase) = (select2(hard_reset, +(freq/ma.SR), phase) : ma.decimal) ~ _
|
|
48
|
-
with {
|
|
49
|
-
hard_reset = (1-1')|reset; // To correctly start at `phase` at the first sample
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// This works:
|
|
53
|
-
/*
|
|
54
|
-
process = m_hsp_phasor(freq, 0, 0) : wavetable(sf)*en.adsr(.01, .01, 1, .1, gate)*gain
|
|
55
|
-
with {
|
|
56
|
-
sf = soundfile("Square[url:{'square.wav'}]",1);
|
|
57
|
-
freq = hslider("freq", 440, 20, 20000, .01);
|
|
58
|
-
gate = hslider("gate", 0, 0, 1, .01);
|
|
59
|
-
gain = hslider("gain", 0, 0, 1, .01);
|
|
60
|
-
};
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// This doesn't compile:
|
|
65
|
-
process = m_hsp_phasor(freq, 0, 0) : aa_wavetable(sf, freq)*en.adsr(.01, .01, 1, .1, gate)*gain
|
|
66
|
-
with {
|
|
67
|
-
sf(i) = soundfile("Square%i [url:{'square.wav'}]",1);
|
|
68
|
-
freq = hslider("freq", 440, 20, 2000, .01);
|
|
69
|
-
gate = hslider("gate", 0.5, 0, 1, .01);
|
|
70
|
-
gain = hslider("gain", 0.5, 0, 1, .01);
|
|
71
|
-
};
|