@grame/faustwasm 0.9.2 → 0.9.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/faustwasm/index.js +2 -4
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.js +5 -7
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.js +2 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.js +5 -7
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustAudioWorkletProcessor.ts +2 -2
- package/src/FaustFFTAudioWorkletProcessor.ts +14 -14
- package/test/faustlive-wasm/faustwasm/index.js +2 -4
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
Binary file
|
package/package.json
CHANGED
|
@@ -140,8 +140,8 @@ const getFaustAudioWorkletProcessor = <Poly extends boolean = false>(dependencie
|
|
|
140
140
|
for (const path in parameters) {
|
|
141
141
|
const [paramValue] = parameters[path];
|
|
142
142
|
if (paramValue !== this.paramValuesCache[path]) {
|
|
143
|
-
|
|
144
|
-
this.
|
|
143
|
+
// Set value and update the cache
|
|
144
|
+
this.setParamValue(path, paramValue);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
if (this.fCommunicator.getNewAccDataAvailable()) {
|
|
@@ -53,7 +53,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
53
53
|
FaustAudioWorkletProcessorCommunicator,
|
|
54
54
|
FFTUtils
|
|
55
55
|
} = dependencies;
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
const {
|
|
58
58
|
processorName,
|
|
59
59
|
dspName,
|
|
@@ -154,7 +154,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
154
154
|
private window: Float32Array;
|
|
155
155
|
/** Generated from the current window's rolling sum square */
|
|
156
156
|
private windowSumSquare: Float32Array;
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
/** FFT constructor */
|
|
159
159
|
private FFT: typeof InterfaceFFT;
|
|
160
160
|
/** Real FFT interface */
|
|
@@ -185,7 +185,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
185
185
|
this.port.addEventListener("message", this.handleMessageAux);
|
|
186
186
|
this.port.start();
|
|
187
187
|
this.communicator = new FaustAudioWorkletProcessorCommunicator(this.port);
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
const { parameterDescriptors } = (this.constructor as typeof AudioWorkletProcessor);
|
|
190
190
|
parameterDescriptors.forEach((pd) => {
|
|
191
191
|
this.paramValuesCache[pd.name] = pd.defaultValue || 0;
|
|
@@ -251,7 +251,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
251
251
|
setupWamEventHandler() {
|
|
252
252
|
if (!this.wamInfo) return;
|
|
253
253
|
const { moduleId, instanceId } = this.wamInfo;
|
|
254
|
-
|
|
254
|
+
const { webAudioModules } = (globalThis as unknown as WamAudioWorkletGlobalScope);
|
|
255
255
|
const ModuleScope = webAudioModules.getModuleScope(moduleId) as WamParamMgrSDKBaseModuleScope;
|
|
256
256
|
const paramMgrProcessor = ModuleScope?.paramMgrProcessors?.[instanceId];
|
|
257
257
|
if (!paramMgrProcessor) return;
|
|
@@ -349,21 +349,21 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
349
349
|
const inputChannels = input?.length || 0;
|
|
350
350
|
const outputChannels = output?.length || 0;
|
|
351
351
|
// if (input.length === 0) return true;
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
const bufferSize = input?.length ? Math.max(...input.map(c => c.length)) || 128 : 128;
|
|
354
|
-
|
|
354
|
+
|
|
355
355
|
// Reset FFT and related buffers if necessary (checks in the resetFFT method)
|
|
356
356
|
this.noIFFT = !!parameters.noIFFT[0];
|
|
357
357
|
this.resetFFT(~~parameters.fftSize[0], ~~parameters.fftOverlap[0], ~~parameters.windowFunction[0], inputChannels, outputChannels, bufferSize);
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
if (!this.fDSPCode) return true;
|
|
360
|
-
|
|
360
|
+
|
|
361
361
|
for (const path in parameters) {
|
|
362
362
|
if (!!fftParamKeywords.find(k => `/${path}`.endsWith(k))) continue;
|
|
363
363
|
const [paramValue] = parameters[path];
|
|
364
364
|
if (paramValue !== this.paramValuesCache[path]) {
|
|
365
|
-
|
|
366
|
-
this.
|
|
365
|
+
// Set value and update the cache
|
|
366
|
+
this.setParamValue(path, paramValue);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
if (this.communicator.getNewAccDataAvailable()) {
|
|
@@ -395,10 +395,10 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
395
395
|
this.$inputWrite += bufferSize;
|
|
396
396
|
this.$inputWrite %= this.fftBufferSize;
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
|
|
399
399
|
// Do FFT if necessary
|
|
400
400
|
this.processFFT();
|
|
401
|
-
|
|
401
|
+
|
|
402
402
|
// Read from fftOutput buffer for audio output, applying windowSumSquare to reverse the doubled windowing effect
|
|
403
403
|
for (let i = 0; i < output.length; i++) {
|
|
404
404
|
setTypedArray(output[i], this.fftOutput[i], 0, this.$outputRead);
|
|
@@ -497,7 +497,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
497
497
|
const fftHopSize = ~~Math.max(1, fftSize / fftOverlap);
|
|
498
498
|
const latency = fftSize - Math.min(fftHopSize, bufferSize);
|
|
499
499
|
let windowFunction: TWindowFunction | null = null;
|
|
500
|
-
|
|
500
|
+
|
|
501
501
|
// set the window function from the injected list
|
|
502
502
|
if (windowFunctionIn !== 0) {
|
|
503
503
|
windowFunction = typeof windowFunctions === "object" ? windowFunctions[~~windowFunctionIn - 1] || null : null;
|
|
@@ -525,7 +525,7 @@ const getFaustFFTAudioWorkletProcessor = (dependencies: FaustFFTAudioWorkletProc
|
|
|
525
525
|
this.noIFFTBuffer = new Float32Array(this.fftSize);
|
|
526
526
|
this.createFFTProcessor();
|
|
527
527
|
}
|
|
528
|
-
|
|
528
|
+
|
|
529
529
|
// Calculate a window from the window function, prepare the windowSumSquare buffer
|
|
530
530
|
if (fftSizeChanged || fftOverlapChanged || windowFunction !== this.windowFunction) {
|
|
531
531
|
this.windowFunction = windowFunction;
|
|
@@ -150,8 +150,7 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
|
|
|
150
150
|
for (const path in parameters) {
|
|
151
151
|
const [paramValue] = parameters[path];
|
|
152
152
|
if (paramValue !== this.paramValuesCache[path]) {
|
|
153
|
-
this.
|
|
154
|
-
this.paramValuesCache[path] = paramValue;
|
|
153
|
+
this.setParamValue(path, paramValue);
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
156
|
if (this.fCommunicator.getNewAccDataAvailable()) {
|
|
@@ -625,8 +624,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
|
|
|
625
624
|
continue;
|
|
626
625
|
const [paramValue] = parameters[path];
|
|
627
626
|
if (paramValue !== this.paramValuesCache[path]) {
|
|
628
|
-
this.
|
|
629
|
-
this.paramValuesCache[path] = paramValue;
|
|
627
|
+
this.setParamValue(path, paramValue);
|
|
630
628
|
}
|
|
631
629
|
}
|
|
632
630
|
if (this.communicator.getNewAccDataAvailable()) {
|