Replacing old reverb by better convolution

This commit is contained in:
Raphael Forment 2023-09-30 22:04:22 +02:00
parent 8a741952df
commit 0ad0046a76
3 changed files with 236 additions and 16 deletions

View file

@ -107,17 +107,24 @@ function getDelay(orbit, delaytime, delayfeedback, t) {
}
let reverbs = {};
function getReverb(orbit, duration = 2) {
// If no reverb has been created for a given orbit, create one
if (!reverbs[orbit]) {
const ac = getAudioContext();
const reverb = ac.createReverb(duration);
const reverb = ac.createReverb(duration, getAudioContext());
reverb.connect(getDestination());
console.log(reverb)
reverbs[orbit] = reverb;
}
// Update the reverb duration if needed after instanciation
if (reverbs[orbit].duration !== duration) {
reverbs[orbit] = reverbs[orbit].setDuration(duration);
reverbs[orbit].duration = duration;
}
return reverbs[orbit];
}