mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-23 19:48:31 +00:00
28 lines
725 B
JavaScript
28 lines
725 B
JavaScript
import reverbGen from './reverbGen.mjs';
|
|
|
|
if (typeof AudioContext !== 'undefined') {
|
|
AudioContext.prototype.generateReverb = reverbGen.generateReverb;
|
|
AudioContext.prototype.createReverb = function(duration, audioContext) {
|
|
const convolver = this.createConvolver();
|
|
convolver.setDuration = (d) => {
|
|
this.generateReverb(
|
|
{
|
|
audioContext,
|
|
sampleRate: 44100,
|
|
numChannels: 2,
|
|
decayTime: d,
|
|
fadeInTime: d,
|
|
lpFreqStart: 2000,
|
|
lpFreqEnd: 15000,
|
|
},
|
|
(buffer) => {
|
|
convolver.buffer = buffer;
|
|
}
|
|
);
|
|
convolver.duration = d;
|
|
};
|
|
convolver.setDuration(duration);
|
|
return convolver;
|
|
};
|
|
}
|