@grame/faustwasm 0.15.6 → 0.16.1

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.15.6",
3
+ "version": "0.16.1",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -314,7 +314,10 @@ export class FaustAudioWorkletNode<
314
314
 
315
315
  setParamValue(path: string, value: number) {
316
316
  const resolved = this.fParamAliases[path] || path;
317
- this.port.postMessage({ type: 'param', data: { path: resolved, value } });
317
+ this.port.postMessage({
318
+ type: 'param',
319
+ data: { path: resolved, value }
320
+ });
318
321
  // Set value on AudioParam (but this is not used on Processor side for now)
319
322
  const param = this.parameters.get(resolved);
320
323
  if (param) param.setValueAtTime(value, this.context.currentTime);
@@ -342,6 +345,26 @@ export class FaustAudioWorkletNode<
342
345
  return this.fDescriptor;
343
346
  }
344
347
 
348
+ init() {
349
+ this.port.postMessage({ type: 'init' });
350
+ }
351
+
352
+ instanceInit() {
353
+ this.port.postMessage({ type: 'instanceInit' });
354
+ }
355
+
356
+ instanceClear() {
357
+ this.port.postMessage({ type: 'instanceClear' });
358
+ }
359
+
360
+ instanceConstants() {
361
+ this.port.postMessage({ type: 'instanceConstants' });
362
+ }
363
+
364
+ instanceResetUserInterface() {
365
+ this.port.postMessage({ type: 'instanceResetUserInterface' });
366
+ }
367
+
345
368
  start() {
346
369
  this.port.postMessage({ type: 'start' });
347
370
  }
@@ -44,18 +44,17 @@ export interface FaustAudioWorkletProcessorDependencies<
44
44
  FaustWasmInstantiator: typeof FaustWasmInstantiator;
45
45
  FaustAudioWorkletProcessorCommunicator: typeof FaustAudioWorkletProcessorCommunicator;
46
46
  }
47
- export interface FaustAudioWorkletNodeOptions<Poly extends boolean = false>
48
- extends AudioWorkletNodeOptions {
47
+ export interface FaustAudioWorkletNodeOptions<
48
+ Poly extends boolean = false
49
+ > extends AudioWorkletNodeOptions {
49
50
  processorOptions: Poly extends true
50
51
  ? FaustPolyAudioWorkletProcessorOptions
51
52
  : FaustMonoAudioWorkletProcessorOptions;
52
53
  }
53
- export interface FaustMonoAudioWorkletNodeOptions
54
- extends AudioWorkletNodeOptions {
54
+ export interface FaustMonoAudioWorkletNodeOptions extends AudioWorkletNodeOptions {
55
55
  processorOptions: FaustMonoAudioWorkletProcessorOptions;
56
56
  }
57
- export interface FaustPolyAudioWorkletNodeOptions
58
- extends AudioWorkletNodeOptions {
57
+ export interface FaustPolyAudioWorkletNodeOptions extends AudioWorkletNodeOptions {
59
58
  processorOptions: FaustPolyAudioWorkletProcessorOptions;
60
59
  }
61
60
  export interface FaustAudioWorkletProcessorOptions {
@@ -65,12 +64,10 @@ export interface FaustAudioWorkletProcessorOptions {
65
64
  moduleId?: string;
66
65
  instanceId?: string;
67
66
  }
68
- export interface FaustMonoAudioWorkletProcessorOptions
69
- extends FaustAudioWorkletProcessorOptions {
67
+ export interface FaustMonoAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
70
68
  factory: LooseFaustDspFactory;
71
69
  }
72
- export interface FaustPolyAudioWorkletProcessorOptions
73
- extends FaustAudioWorkletProcessorOptions {
70
+ export interface FaustPolyAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
74
71
  voiceFactory: LooseFaustDspFactory;
75
72
  mixerModule: WebAssembly.Module;
76
73
  voices: number;
@@ -283,6 +280,26 @@ const getFaustAudioWorkletProcessor = <Poly extends boolean = false>(
283
280
  this.setupWamEventHandler();
284
281
  break;
285
282
  }
283
+ case 'init': {
284
+ this.fDSPCode.init();
285
+ break;
286
+ }
287
+ case 'instanceInit': {
288
+ this.fDSPCode.instanceInit();
289
+ break;
290
+ }
291
+ case 'instanceClear': {
292
+ this.fDSPCode.instanceClear();
293
+ break;
294
+ }
295
+ case 'instanceConstants': {
296
+ this.fDSPCode.instanceConstants();
297
+ break;
298
+ }
299
+ case 'instanceResetUserInterface': {
300
+ this.fDSPCode.instanceResetUserInterface();
301
+ break;
302
+ }
286
303
  case 'start': {
287
304
  this.fDSPCode.start();
288
305
  break;
@@ -367,7 +367,7 @@ export class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
367
367
  monoDsp.getNumOutputs()
368
368
  ) as FaustMonoScriptProcessorNode;
369
369
  Object.setPrototypeOf(sp, FaustMonoScriptProcessorNode.prototype);
370
- sp.init(monoDsp);
370
+ sp.setupNode(monoDsp);
371
371
  return sp as SP extends true
372
372
  ? FaustMonoScriptProcessorNode
373
373
  : FaustMonoAudioWorkletNode;
@@ -856,7 +856,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
856
856
  polyDsp.getNumOutputs()
857
857
  ) as FaustPolyScriptProcessorNode;
858
858
  Object.setPrototypeOf(sp, FaustPolyScriptProcessorNode.prototype);
859
- sp.init(polyDsp);
859
+ sp.setupNode(polyDsp);
860
860
  return sp as SP extends true
861
861
  ? FaustPolyScriptProcessorNode
862
862
  : FaustPolyAudioWorkletNode;
@@ -25,11 +25,9 @@ export interface IFaustOfflineProcessor extends IFaustBaseWebAudioDsp {
25
25
  }
26
26
 
27
27
  export interface IFaustMonoOfflineProcessor
28
- extends IFaustOfflineProcessor,
29
- IFaustMonoWebAudioDsp {}
28
+ extends IFaustOfflineProcessor, IFaustMonoWebAudioDsp {}
30
29
  export interface IFaustPolyOfflineProcessor
31
- extends IFaustOfflineProcessor,
32
- IFaustPolyWebAudioDsp {}
30
+ extends IFaustOfflineProcessor, IFaustPolyWebAudioDsp {}
33
31
 
34
32
  export class FaustOfflineProcessor<Poly extends boolean = false> {
35
33
  protected fDSPCode!: Poly extends true
@@ -190,6 +188,26 @@ export class FaustOfflineProcessor<Poly extends boolean = false> {
190
188
  return this.fDSPCode.getUI();
191
189
  }
192
190
 
191
+ init() {
192
+ this.fDSPCode.init();
193
+ }
194
+
195
+ instanceInit() {
196
+ this.fDSPCode.instanceInit();
197
+ }
198
+
199
+ instanceClear() {
200
+ this.fDSPCode.instanceClear();
201
+ }
202
+
203
+ instanceConstants() {
204
+ this.fDSPCode.instanceConstants();
205
+ }
206
+
207
+ instanceResetUserInterface() {
208
+ this.fDSPCode.instanceResetUserInterface();
209
+ }
210
+
193
211
  start() {
194
212
  this.fDSPCode.start();
195
213
  }
@@ -273,7 +291,7 @@ export class FaustOfflineProcessor<Poly extends boolean = false> {
273
291
  outputs[i].set(output, l);
274
292
  }
275
293
  }
276
- l += this.fBufferSize;
294
+ l += sliceLength;
277
295
  onUpdate?.(l);
278
296
  }
279
297
  // The node can be stopped after rendering
@@ -26,7 +26,7 @@ export class FaustScriptProcessorNode<
26
26
  protected handleDeviceMotion = undefined as any;
27
27
  protected handleDeviceOrientation = undefined as any;
28
28
 
29
- init(
29
+ setupNode(
30
30
  instance: Poly extends true
31
31
  ? FaustPolyWebAudioDsp
32
32
  : FaustMonoWebAudioDsp
@@ -71,6 +71,26 @@ export class FaustScriptProcessorNode<
71
71
  this.start();
72
72
  }
73
73
 
74
+ init() {
75
+ this.fDSPCode.init();
76
+ }
77
+
78
+ instanceInit() {
79
+ this.fDSPCode.instanceInit();
80
+ }
81
+
82
+ instanceClear() {
83
+ this.fDSPCode.instanceClear();
84
+ }
85
+
86
+ instanceConstants() {
87
+ this.fDSPCode.instanceConstants();
88
+ }
89
+
90
+ instanceResetUserInterface() {
91
+ this.fDSPCode.instanceResetUserInterface();
92
+ }
93
+
74
94
  // Public API
75
95
 
76
96
  /** Start accelerometer and gyroscope handlers */
@@ -678,6 +678,31 @@ export interface IFaustBaseWebAudioDsp {
678
678
  event: Pick<DeviceOrientationEvent, 'alpha' | 'beta' | 'gamma'>
679
679
  ): void;
680
680
 
681
+ /**
682
+ * Reinitialize the DSP using its configured sample rate.
683
+ */
684
+ init(): void;
685
+
686
+ /**
687
+ * Reinitialize the DSP instance state using its configured sample rate.
688
+ */
689
+ instanceInit(): void;
690
+
691
+ /**
692
+ * Clear the DSP instance state.
693
+ */
694
+ instanceClear(): void;
695
+
696
+ /**
697
+ * Reinitialize the DSP instance constants using its configured sample rate.
698
+ */
699
+ instanceConstants(): void;
700
+
701
+ /**
702
+ * Reset DSP user interface parameters to their default values.
703
+ */
704
+ instanceResetUserInterface(): void;
705
+
681
706
  /**
682
707
  * Start the DSP audio processing.
683
708
  */
@@ -696,8 +721,7 @@ export interface IFaustBaseWebAudioDsp {
696
721
 
697
722
  export type IFaustMonoWebAudioDsp = IFaustBaseWebAudioDsp;
698
723
  export interface IFaustMonoWebAudioNode
699
- extends IFaustMonoWebAudioDsp,
700
- AudioNode {}
724
+ extends IFaustMonoWebAudioDsp, AudioNode {}
701
725
 
702
726
  export interface IFaustPolyWebAudioDsp extends IFaustBaseWebAudioDsp {
703
727
  /**
@@ -726,8 +750,7 @@ export interface IFaustPolyWebAudioDsp extends IFaustBaseWebAudioDsp {
726
750
  allNotesOff(hard: boolean): void;
727
751
  }
728
752
  export interface IFaustPolyWebAudioNode
729
- extends IFaustPolyWebAudioDsp,
730
- AudioNode {}
753
+ extends IFaustPolyWebAudioDsp, AudioNode {}
731
754
 
732
755
  export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
733
756
  protected fOutputHandler: OutputParamHandler | null = null;
@@ -1040,7 +1063,9 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
1040
1063
  .split(';')
1041
1064
  .map((str) =>
1042
1065
  str.length <= 2 ? '' : str.substring(1, str.length - 1)
1043
- );
1066
+ )
1067
+ .map((str) => str.trim())
1068
+ .filter((str) => str.length > 0);
1044
1069
  }
1045
1070
 
1046
1071
  get hasAccInput() {
@@ -1574,6 +1599,16 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
1574
1599
  this.stopSensors();
1575
1600
  }
1576
1601
 
1602
+ init() {}
1603
+
1604
+ instanceInit() {}
1605
+
1606
+ instanceClear() {}
1607
+
1608
+ instanceConstants() {}
1609
+
1610
+ instanceResetUserInterface() {}
1611
+
1577
1612
  start() {
1578
1613
  this.fProcessing = true;
1579
1614
  }
@@ -1597,6 +1632,7 @@ export class FaustMonoWebAudioDsp
1597
1632
  {
1598
1633
  private fInstance: FaustMonoDspInstance;
1599
1634
  private fDSP!: number;
1635
+ private fSampleRate: number;
1600
1636
 
1601
1637
  constructor(
1602
1638
  instance: FaustMonoDspInstance,
@@ -1607,6 +1643,7 @@ export class FaustMonoWebAudioDsp
1607
1643
  ) {
1608
1644
  super(sampleSize, bufferSize, soundfiles);
1609
1645
  this.fInstance = instance;
1646
+ this.fSampleRate = sampleRate;
1610
1647
 
1611
1648
  console.log(`sampleSize: ${sampleSize} bufferSize: ${bufferSize}`);
1612
1649
 
@@ -1635,6 +1672,26 @@ export class FaustMonoWebAudioDsp
1635
1672
  }
1636
1673
  }
1637
1674
 
1675
+ init() {
1676
+ this.fInstance.api.init(this.fDSP, this.fSampleRate);
1677
+ }
1678
+
1679
+ instanceInit() {
1680
+ this.fInstance.api.instanceInit(this.fDSP, this.fSampleRate);
1681
+ }
1682
+
1683
+ instanceClear() {
1684
+ this.fInstance.api.instanceClear(this.fDSP);
1685
+ }
1686
+
1687
+ instanceConstants() {
1688
+ this.fInstance.api.instanceConstants(this.fDSP, this.fSampleRate);
1689
+ }
1690
+
1691
+ instanceResetUserInterface() {
1692
+ this.fInstance.api.instanceResetUserInterface(this.fDSP);
1693
+ }
1694
+
1638
1695
  private initMemory(): number {
1639
1696
  // Start of DSP memory: Mono DSP is placed first with index 0
1640
1697
  this.fDSP = 0;
@@ -1886,6 +1943,7 @@ export class FaustWebAudioDspVoice {
1886
1943
  private fVelLabel: number[] = [];
1887
1944
  private fDSP: number; // Voice DSP location in wasm memory
1888
1945
  private fAPI: IFaustDspInstance; // Voice DSP code
1946
+ private fSampleRate: number;
1889
1947
  // Accessed by PolyDSPImp class
1890
1948
  fCurNote = FaustWebAudioDspVoice.kFreeVoice;
1891
1949
  fNextNote = -1;
@@ -1902,7 +1960,8 @@ export class FaustWebAudioDspVoice {
1902
1960
  ) {
1903
1961
  this.fDSP = $dsp;
1904
1962
  this.fAPI = api;
1905
- this.fAPI.init(this.fDSP, sampleRate);
1963
+ this.fSampleRate = sampleRate;
1964
+ this.init(sampleRate);
1906
1965
  this.extractPaths(inputItems, pathTable);
1907
1966
  }
1908
1967
 
@@ -1914,6 +1973,26 @@ export class FaustWebAudioDspVoice {
1914
1973
  return velocity / 127.0;
1915
1974
  }
1916
1975
 
1976
+ init(sampleRate: number) {
1977
+ this.fAPI.init(this.fDSP, sampleRate);
1978
+ }
1979
+
1980
+ instanceInit() {
1981
+ this.fAPI.instanceInit(this.fDSP, this.fSampleRate);
1982
+ }
1983
+
1984
+ instanceClear() {
1985
+ this.fAPI.instanceClear(this.fDSP);
1986
+ }
1987
+
1988
+ instanceConstants() {
1989
+ this.fAPI.instanceConstants(this.fDSP, this.fSampleRate);
1990
+ }
1991
+
1992
+ instanceResetUserInterface() {
1993
+ this.fAPI.instanceResetUserInterface(this.fDSP);
1994
+ }
1995
+
1917
1996
  private extractPaths(
1918
1997
  inputItems: string[],
1919
1998
  pathTable: { [address: string]: number }
@@ -2023,6 +2102,7 @@ export class FaustPolyWebAudioDsp
2023
2102
  private fAudioMixing!: number;
2024
2103
  private fAudioMixingHalf!: number;
2025
2104
  private fVoiceTable: FaustWebAudioDspVoice[];
2105
+ private fSampleRate: number;
2026
2106
 
2027
2107
  constructor(
2028
2108
  instance: FaustPolyDspInstance,
@@ -2033,6 +2113,7 @@ export class FaustPolyWebAudioDsp
2033
2113
  ) {
2034
2114
  super(sampleSize, bufferSize, soundfiles);
2035
2115
  this.fInstance = instance;
2116
+ this.fSampleRate = sampleRate;
2036
2117
 
2037
2118
  console.log(`sampleSize: ${sampleSize} bufferSize: ${bufferSize}`);
2038
2119
 
@@ -2085,6 +2166,42 @@ export class FaustPolyWebAudioDsp
2085
2166
  }
2086
2167
  }
2087
2168
 
2169
+ init() {
2170
+ this.fVoiceTable.forEach((voice) => voice.init(this.fSampleRate));
2171
+ if (this.fInstance.effectAPI)
2172
+ this.fInstance.effectAPI.init(this.fEffect, this.fSampleRate);
2173
+ }
2174
+
2175
+ instanceInit() {
2176
+ this.fVoiceTable.forEach((voice) => voice.instanceInit());
2177
+ if (this.fInstance.effectAPI)
2178
+ this.fInstance.effectAPI.instanceInit(
2179
+ this.fEffect,
2180
+ this.fSampleRate
2181
+ );
2182
+ }
2183
+
2184
+ instanceClear() {
2185
+ this.fVoiceTable.forEach((voice) => voice.instanceClear());
2186
+ if (this.fInstance.effectAPI)
2187
+ this.fInstance.effectAPI.instanceClear(this.fEffect);
2188
+ }
2189
+
2190
+ instanceConstants() {
2191
+ this.fVoiceTable.forEach((voice) => voice.instanceConstants());
2192
+ if (this.fInstance.effectAPI)
2193
+ this.fInstance.effectAPI.instanceConstants(
2194
+ this.fEffect,
2195
+ this.fSampleRate
2196
+ );
2197
+ }
2198
+
2199
+ instanceResetUserInterface() {
2200
+ this.fVoiceTable.forEach((voice) => voice.instanceResetUserInterface());
2201
+ if (this.fInstance.effectAPI)
2202
+ this.fInstance.effectAPI.instanceResetUserInterface(this.fEffect);
2203
+ }
2204
+
2088
2205
  private initMemory() {
2089
2206
  // Effet start at the end of all DSP voices
2090
2207
  this.fEffect = this.fJSONDsp.size * this.fInstance.voices;
@@ -64,32 +64,13 @@ class SoundfileReader {
64
64
  if (item.type === 'soundfile') {
65
65
  const urls = FaustBaseWebAudioDsp.splitSoundfileNames(item.url);
66
66
  // soundfiles.map[item.label] = urls;
67
- urls.forEach((url) => (soundfiles[url] = null));
67
+ urls.filter((url) => url.trim().length > 0)
68
+ .forEach((url) => (soundfiles[url] = null));
68
69
  }
69
70
  };
70
71
  FaustBaseWebAudioDsp.parseUI(dspMeta.ui, callback);
71
72
  return soundfiles;
72
73
  }
73
- /**
74
- * Check if the file exists.
75
- *
76
- * @param url : the url of the file to check
77
- * @returns : true if the file exists, otherwise false
78
- */
79
- private static async checkFileExists(url: string): Promise<boolean> {
80
- try {
81
- console.log(`"checkFileExists" url: ${url}`);
82
- // Fetch in "HEAD" mode does not properly work with the service-worker.js cache, so use "GET" mode for now
83
- //const response = await fetch(url, { method: "HEAD" });
84
- const response = await fetch(url);
85
- console.log(`"checkFileExists" response.ok: ${response.ok}`);
86
- return response.ok; // Will be true if the status code is 200-299
87
- } catch (error) {
88
- console.error('Fetch error:', error);
89
- return false;
90
- }
91
- }
92
-
93
74
  /**
94
75
  * Fetch the soundfile.
95
76
  *
@@ -136,17 +117,21 @@ class SoundfileReader {
136
117
  .href
137
118
  )
138
119
  ];
139
- const checkResults = await Promise.all(
140
- urlsToCheck.map((url) => this.checkFileExists(url))
141
- );
142
- const successIndex = checkResults.findIndex((r) => !!r);
143
- if (successIndex === -1)
144
- throw new Error(
145
- `Failed to load sound file ${filename}, all check failed.`
146
- );
147
- soundfiles![filename] = await this.fetchSoundfile(
148
- urlsToCheck[successIndex],
149
- audioCtx
120
+ // Try each candidate once to avoid double downloads (no preflight GET).
121
+ let lastError: unknown = null;
122
+ for (const url of urlsToCheck) {
123
+ try {
124
+ soundfiles![filename] = await this.fetchSoundfile(
125
+ url,
126
+ audioCtx
127
+ );
128
+ return;
129
+ } catch (error) {
130
+ lastError = error;
131
+ }
132
+ }
133
+ throw new Error(
134
+ `Failed to load sound file ${filename}, all check failed. Last error: ${String(lastError)}`
150
135
  );
151
136
  }
152
137
 
@@ -52,7 +52,12 @@ const faust2wavFiles = async (
52
52
  let input = undefined;
53
53
  if (inputWav) {
54
54
  console.log(`Reading input wav file ${inputWav}.`);
55
- const inputBuffer = fs.readFileSync(inputWav).buffer;
55
+ const inputBufferView = fs.readFileSync(inputWav);
56
+ // Slice to the exact Buffer view to avoid extra bytes from the backing ArrayBuffer.
57
+ const inputBuffer = inputBufferView.buffer.slice(
58
+ inputBufferView.byteOffset,
59
+ inputBufferView.byteOffset + inputBufferView.byteLength
60
+ );
56
61
  console.log(`Decoding...`);
57
62
  input = WavDecoder.decode(inputBuffer).channelData;
58
63
  }
@@ -729,6 +729,26 @@ export interface IFaustBaseWebAudioDsp {
729
729
  * event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">
730
730
  */
731
731
  propagateGyr(event: Pick<DeviceOrientationEvent, "alpha" | "beta" | "gamma">): void;
732
+ /**
733
+ * Reinitialize the DSP using its configured sample rate.
734
+ */
735
+ init(): void;
736
+ /**
737
+ * Reinitialize the DSP instance state using its configured sample rate.
738
+ */
739
+ instanceInit(): void;
740
+ /**
741
+ * Clear the DSP instance state.
742
+ */
743
+ instanceClear(): void;
744
+ /**
745
+ * Reinitialize the DSP instance constants using its configured sample rate.
746
+ */
747
+ instanceConstants(): void;
748
+ /**
749
+ * Reset DSP user interface parameters to their default values.
750
+ */
751
+ instanceResetUserInterface(): void;
732
752
  /**
733
753
  * Start the DSP audio processing.
734
754
  */
@@ -903,6 +923,11 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
903
923
  hasSoundfiles(): boolean;
904
924
  startSensors(): void;
905
925
  stopSensors(): void;
926
+ init(): void;
927
+ instanceInit(): void;
928
+ instanceClear(): void;
929
+ instanceConstants(): void;
930
+ instanceResetUserInterface(): void;
906
931
  start(): void;
907
932
  stop(): void;
908
933
  destroy(): void;
@@ -910,7 +935,13 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
910
935
  export declare class FaustMonoWebAudioDsp extends FaustBaseWebAudioDsp implements IFaustMonoWebAudioDsp {
911
936
  private fInstance;
912
937
  private fDSP;
938
+ private fSampleRate;
913
939
  constructor(instance: FaustMonoDspInstance, sampleRate: number, sampleSize: number, bufferSize: number, soundfiles: LooseFaustDspFactory["soundfiles"]);
940
+ init(): void;
941
+ instanceInit(): void;
942
+ instanceClear(): void;
943
+ instanceConstants(): void;
944
+ instanceResetUserInterface(): void;
914
945
  private initMemory;
915
946
  toString(): string;
916
947
  compute(input: Float32Array[] | ((input: Float32Array[] | Float64Array[]) => any), output: Float32Array[] | ((output: Float32Array[] | Float64Array[]) => any)): boolean;
@@ -938,6 +969,7 @@ export declare class FaustWebAudioDspVoice {
938
969
  private fVelLabel;
939
970
  private fDSP;
940
971
  private fAPI;
972
+ private fSampleRate;
941
973
  fCurNote: number;
942
974
  fNextNote: number;
943
975
  fNextVel: number;
@@ -948,6 +980,11 @@ export declare class FaustWebAudioDspVoice {
948
980
  }, sampleRate: number);
949
981
  static midiToFreq(note: number): number;
950
982
  static normalizeVelocity(velocity: number): number;
983
+ init(sampleRate: number): void;
984
+ instanceInit(): void;
985
+ instanceClear(): void;
986
+ instanceConstants(): void;
987
+ instanceResetUserInterface(): void;
951
988
  private extractPaths;
952
989
  keyOn(pitch: number, velocity: number, legato?: boolean): void;
953
990
  keyOff(hard?: boolean): void;
@@ -963,7 +1000,13 @@ export declare class FaustPolyWebAudioDsp extends FaustBaseWebAudioDsp implement
963
1000
  private fAudioMixing;
964
1001
  private fAudioMixingHalf;
965
1002
  private fVoiceTable;
1003
+ private fSampleRate;
966
1004
  constructor(instance: FaustPolyDspInstance, sampleRate: number, sampleSize: number, bufferSize: number, soundfiles: LooseFaustDspFactory["soundfiles"]);
1005
+ init(): void;
1006
+ instanceInit(): void;
1007
+ instanceClear(): void;
1008
+ instanceConstants(): void;
1009
+ instanceResetUserInterface(): void;
967
1010
  private initMemory;
968
1011
  toString(): string;
969
1012
  private allocVoice;
@@ -1258,6 +1301,11 @@ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
1258
1301
  getJSON(): string;
1259
1302
  getDescriptors(): FaustUIInputItem[];
1260
1303
  getUI(): FaustUIDescriptor;
1304
+ init(): void;
1305
+ instanceInit(): void;
1306
+ instanceClear(): void;
1307
+ instanceConstants(): void;
1308
+ instanceResetUserInterface(): void;
1261
1309
  start(): void;
1262
1310
  stop(): void;
1263
1311
  destroy(): void;
@@ -1378,13 +1426,6 @@ export declare class SoundfileReader {
1378
1426
  * @returns : the URLs
1379
1427
  */
1380
1428
  static findSoundfilesFromMeta(dspMeta: FaustDspMeta): LooseFaustDspFactory["soundfiles"];
1381
- /**
1382
- * Check if the file exists.
1383
- *
1384
- * @param url : the url of the file to check
1385
- * @returns : true if the file exists, otherwise false
1386
- */
1387
- private static checkFileExists;
1388
1429
  /**
1389
1430
  * Fetch the soundfile.
1390
1431
  *
@@ -1470,6 +1511,11 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1470
1511
  getJSON(): string;
1471
1512
  getUI(): FaustUIDescriptor;
1472
1513
  getDescriptors(): FaustUIInputItem[];
1514
+ init(): void;
1515
+ instanceInit(): void;
1516
+ instanceClear(): void;
1517
+ instanceConstants(): void;
1518
+ instanceResetUserInterface(): void;
1473
1519
  start(): void;
1474
1520
  stop(): void;
1475
1521
  destroy(): void;
@@ -1508,7 +1554,12 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
1508
1554
  protected fOutputs: Float32Array[];
1509
1555
  protected handleDeviceMotion: any;
1510
1556
  protected handleDeviceOrientation: any;
1511
- init(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp): void;
1557
+ setupNode(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp): void;
1558
+ init(): void;
1559
+ instanceInit(): void;
1560
+ instanceClear(): void;
1561
+ instanceConstants(): void;
1562
+ instanceResetUserInterface(): void;
1512
1563
  /** Start accelerometer and gyroscope handlers */
1513
1564
  startSensors(): Promise<void>;
1514
1565
  /** Stop accelerometer and gyroscope handlers */