javascript - 使用 Web Audio API 或任何 Javascript 音频库(如 howler.js、tone.js)的音频效果(左右声道之间有 20 毫秒的延迟)?

标签 javascript ffmpeg web-audio-api howler.js soundeffect

我想知道 中是否有任何选项howler.js 、tone.js 或任何其他 javascript 音频库 我可以用来添加 20ms 延迟 左右声道之间,使音频聆听体验更加身临其境。
可以使用带有 howler.js 的音频 Sprite 来实现吗? (但我猜它不能分开左右声道)
https://medium.com/game-development-stuff/how-to-create-audiosprites-to-use-with-howler-js-beed5d006ac1
有没有?
在这里也问过同样的问题:https://github.com/goldfire/howler.js/issues/1374
我通常在 ffdshow 音频处理器下启用此选项,同时在我的电脑上使用 MPC-HC(Mega 版)播放音频。我想知道如何使用 Web Audio API 或 吼叫.js ?
enter image description here
有点像这种效果:只需将任一 channel 延迟 20 毫秒
就像我们在 Adob​​e Audition 中所做的那样
enter image description here

最佳答案

不熟悉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>)

关于javascript - 使用 Web Audio API 或任何 Javascript 音频库(如 howler.js、tone.js)的音频效果(左右声道之间有 20 毫秒的延迟)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62911373/

相关文章:

android - 如何使用 FFmpeg 在单个命令中修剪、裁剪和添加叠加层

javascript - 将数据从较小的 AudioBuffer 复制到较大的 Float32Array

audio - 通过WebSocket流音频-Web音频

javascript - 颜色编码平行坐标

javascript - Knockoutjs 可观察 bool 值返回奇怪的结果

javascript - 如何使用 Selenium 和 Node.JS 驱动 Firefox 滚动到元素?

ffmpeg - avi转mp4 : audio is out of sync

facebook - 在 Ubuntu 16.04 上使用 ffmpeg 从 Icecast 流式传输到 Facebook Live

javascript - 隐藏其容器div后如何使用网络音频api停止iframe中的音频?

javascript - 重复 XMLHttpRequest 请求