From dadb8119e8cb1878bb7cefb4aec30515f90d859a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Mon, 31 Oct 2022 20:34:07 +0100 Subject: [PATCH] fix: reverb mono --- packages/webaudio/reverb.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webaudio/reverb.mjs b/packages/webaudio/reverb.mjs index 341731e4..e6d31f6a 100644 --- a/packages/webaudio/reverb.mjs +++ b/packages/webaudio/reverb.mjs @@ -1,7 +1,7 @@ if (typeof AudioContext !== 'undefined') { - AudioContext.prototype.impulseResponse = function (duration) { + AudioContext.prototype.impulseResponse = function (duration, channels = 1) { const length = this.sampleRate * duration; - const impulse = this.createBuffer(2, length, this.sampleRate); + const impulse = this.createBuffer(channels, length, this.sampleRate); const IR = impulse.getChannelData(0); for (let i = 0; i < length; i++) IR[i] = (2 * Math.random() - 1) * Math.pow(1 - i / length, duration); return impulse;