mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 21:18:49 +00:00
fix: reverb mono
This commit is contained in:
parent
335d54b5f4
commit
dadb8119e8
@ -1,7 +1,7 @@
|
|||||||
if (typeof AudioContext !== 'undefined') {
|
if (typeof AudioContext !== 'undefined') {
|
||||||
AudioContext.prototype.impulseResponse = function (duration) {
|
AudioContext.prototype.impulseResponse = function (duration, channels = 1) {
|
||||||
const length = this.sampleRate * duration;
|
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);
|
const IR = impulse.getChannelData(0);
|
||||||
for (let i = 0; i < length; i++) IR[i] = (2 * Math.random() - 1) * Math.pow(1 - i / length, duration);
|
for (let i = 0; i < length; i++) IR[i] = (2 * Math.random() - 1) * Math.pow(1 - i / length, duration);
|
||||||
return impulse;
|
return impulse;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user