javascript - 使用 Web Audio API 或任何 Javascript 音频库(如 howler.js、tone.js)的音频效果(左右声道之间有 20 毫秒的延迟)?
问题描述
我想知道howler.js、tone.js 或任何其他javascript 音频库中是否有任何选项可以用来在左右声道之间添加 20毫秒的延迟,从而使音频聆听体验更加身临其境。
可以使用带有 howler.js 的音频精灵来实现吗?(但我猜它不能分开左右声道) 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 或howler.js 来做到这一点?
解决方案
不熟悉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>)
推荐阅读
- textx - 如何从一行文本中解析关键字和字符串
- python - python 3.9.5 中的诅咒在哪里?
- r - 我想检查其对应行的每个单元格中是否存在像 ABCD 这样的字符串。如果不存在,则应返回 NA
- reactjs - CheckBox 值始终返回 true
- r - 如何在 RMarkdown 中将此表移动到左侧?
- c++ - C++ 类菜单和控制器
- javascript - 反转“order_successful”,尽管发送了参数,但没有找到任何参数。DJANGO
- android - 预打包的数据库具有无效的架构列顺序
- c# - 表格标题单元格有一条分隔线,其他标题不会改变它们的高度
- ansible - 如何使用正则表达式从字典中的字符串中提取值并将其附加到字典中?