Skip to content

Commit

Permalink
normalise applied independent of filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Mar 28, 2024
1 parent e997344 commit 16c19ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
13 changes: 7 additions & 6 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -1390,6 +1390,7 @@ const fetchAudioBuffer = async ({
options: `f=${STATE.filters.highPassFrequency}:poles=1`
})
}
}
if (STATE.audio.normalise){
command.audioFilters(
{
Expand All @@ -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));
Expand Down Expand Up @@ -1427,7 +1428,7 @@ const fetchAudioBuffer = async ({
});
}
});

command.run();
});
}
Expand Down

0 comments on commit 16c19ad

Please sign in to comment.