fix(calls): finalize DTLN integration, stabilize build, and fix formatting

This commit is contained in:
2026-06-16 01:53:24 -04:00
parent 6634b2b8a2
commit 89a2321dd4
3 changed files with 50 additions and 5 deletions
+20 -5
View File
@@ -54,6 +54,10 @@
script: 'speexWorklet.js',
wasm: 'speex.wasm',
},
dtln: {
name: 'noise-suppression-audio-worklet',
script: 'dtlnWorklet.js',
},
gate: {
name: '@sapphi-red/web-noise-suppressor/noise-gate',
script: 'noiseGateWorklet.js',
@@ -115,6 +119,7 @@
}
// Load required modules
var scripts = [PROCESSORS[MODEL].script];
if (MODEL === 'dtln') scripts.push('dtlnProcessor.js');
if (USE_GATE) scripts.push(PROCESSORS.gate.script);
return Promise.all(
@@ -166,14 +171,24 @@
}
// 2. ML Processor
var mlNode = new AudioWorkletNode(ctx, PROCESSORS[MODEL].name, {
var mlOptions = {
channelCount: 1,
channelCountMode: 'explicit',
numberOfInputs: 1,
numberOfOutputs: 1,
outputChannelCount: [1],
processorOptions: { maxChannels: 1, wasmBinary: wasmBinary },
});
processorOptions: { maxChannels: 1 },
};
if (MODEL === 'rnnoise' || MODEL === 'speex') {
mlOptions.processorOptions.wasmBinary = wasmBinary;
} else if (MODEL === 'dtln') {
mlOptions.processorOptions = {
wasmBinary: wasmBinary,
model1: ASSET_BASE + 'model_1.tflite',
model2: ASSET_BASE + 'model_2.tflite',
};
}
var mlNode = new AudioWorkletNode(ctx, PROCESSORS[MODEL].name, mlOptions);
head.connect(mlNode);
mlNode.connect(dest);