From 16c19ad4b66f1e4d55d34082c0a6fd0f6830a0e2 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Thu, 28 Mar 2024 17:01:28 +0000 Subject: [PATCH] normalise applied independent of filters --- js/state.js | 2 +- js/worker.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/state.js b/js/state.js index ef88ffe1..b9b030f1 100644 --- a/js/state.js +++ b/js/state.js @@ -32,7 +32,7 @@ export class State { this.list = 'everything', this.customList = undefined, this.local = true, - this.incrementor = 1, + this.incrementor = 250, this.UUID = 0, this.track = true } diff --git a/js/worker.js b/js/worker.js index c66bc8a9..20d04b1e 100644 --- a/js/worker.js +++ b/js/worker.js @@ -1061,7 +1061,7 @@ async function setupCtx(audio, rate, destination) { previousFilter ? previousFilter.connect(lowshelfFilter) : offlineSource.connect(lowshelfFilter); previousFilter = lowshelfFilter; } - // const from = 2000; + // const from = 2000; // const to = 8000; // const geometricMean = Math.sqrt(from * to); @@ -1072,8 +1072,8 @@ async function setupCtx(audio, rate, destination) { // bandpassFilter.channelCount = 1; // previousFilter ? previousFilter.connect(bandpassFilter) : offlineSource.connect(bandpassFilter); // previousFilter = bandpassFilter; - } - } + } +} if (STATE.audio.gain){ var gainNode = offlineCtx.createGain(); gainNode.gain.value = Math.pow(10, STATE.audio.gain / 20); @@ -1082,7 +1082,7 @@ async function setupCtx(audio, rate, destination) { } else { previousFilter ? previousFilter.connect(offlineCtx.destination) : offlineSource.connect(offlineCtx.destination); } - offlineSource.start(); + offlineSource.start(); return offlineCtx; } ) .catch( (error) => console.warn(error)); @@ -1390,6 +1390,7 @@ const fetchAudioBuffer = async ({ options: `f=${STATE.filters.highPassFrequency}:poles=1` }) } + } if (STATE.audio.normalise){ command.audioFilters( { @@ -1398,7 +1399,7 @@ const fetchAudioBuffer = async ({ } ) } - } + command.on('error', error => { UI.postMessage({event: 'generate-alert', message: error.message}) reject(new Error('fetchAudioBuffer: Error extracting audio segment:', error)); @@ -1427,7 +1428,7 @@ const fetchAudioBuffer = async ({ }); } }); - + command.run(); }); }