【问题标题】:Audio effect ( a 20ms delay between right and the left channel) using Web Audio API or any Javascript Audio Library like howler.js, tone.js?使用 Web Audio API 或任何 Javascript 音频库(如 howler.js、tone.js)的音频效果(左右声道之间有 20 毫秒的延迟)?
【发布时间】:2020-11-04 17:53:30
【问题描述】:
【问题讨论】:
标签:
javascript
ffmpeg
web-audio-api
howler.js
soundeffect
【解决方案1】:
不熟悉howler.js 或tone.js,但我认为他们使用WebAudio。使用普通的 WebAudio,您可以通过以下方式获得所需的内容:
// 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>)