0
votes

I was wondering if there any option in howler.js, tone.js or any other javascript audio library which I can use to add a 20ms delay between the right and the left channel which makes the audio listening experience more immersive.

Can it be achieved using Audio sprites with howler.js ? (but I guess it can't separate the right and the left channels) https://medium.com/game-development-stuff/how-to-create-audiosprites-to-use-with-howler-js-beed5d006ac1

Is there any?

Have also asked the same quest here: https://github.com/goldfire/howler.js/issues/1374

I usually enable this option under ffdshow audio processor while playing audio using MPC-HC (Mega Version) on my pc. I was wondering how can I do it using Web Audio API or howler.js ?

enter image description here

Somewhat like this kind of effect: Just delay the either channel by 20ms Like we do in Adobe Audition enter image description here

1

1 Answers

1
votes

Not familiar with howler.js or tone.js, but I think they use WebAudio. With plain WebAudio, you can get what you want with something like this:

// Let c be the AduioContext and let s be the stereo signal you want to process

// Splits the stereo channel into two mono channels.
let splitter = new ChannelSplitterNode(c, {numberOfOutputs: 2});

// Merges two mono channels into a single stereo channel.
let merger = new ChannelMergerNode(c, {numberOfInputs: 2});

// Delays input by 20 ms.
let delay = new DelayNode(c, {delayTime: 0.02});

// Split the stereo source into 2 separate mono channels.
s.connect(splitter);

// Connect first channel of source directly to the merger
splitter.connect(merger, 0, 0);

// Delay the second channel by 20 ms
splitter.connect(delay, 1, 0).connect(merger, 0, 1);
// Connect the output of the merger to the downstream graph
merger.connect(<node>)