【问题标题】:Web Audio API Delay With Feedback Crashing ChromeWeb 音频 API 延迟与反馈崩溃 Chrome
【发布时间】:2013-09-12 03:27:47
【问题描述】:

每次我尝试在反馈延迟的情况下运行我的代码时,我的 Chrome 浏览器都会崩溃,我会收到蓝屏提示:
“啊,啪!
显示此网页时出现问题。要继续,请重新加载或转到另一个页面。”

我的代码使用了这种结构:

//Create any kind of input (only to test if it works or not);
var oscillator = context.createOscillator();

//Create the delay node and the gain node used on the feedback
var delayNode = context.createDelay();
var feedback = context.createGain();

//Setting the feedback gain
feedback.gain.value = 0.5;

//Make the connections
oscillator.connect(context.destination);
oscillator.connect(delayNode);
delayNode.connect(feedback);
feedback.connect(delayNode);
delayNode.connect(context.destination);//This is where it crashes

【问题讨论】:

  • 什么 Chrome 浏览器版本,你能显示完整的代码吗?因为我一直使用反馈延迟循环。它会在创建节点时崩溃吗?启动()振荡器?
  • 我使用的是 Chrome 31.0.1626.0 开发版。它恰好在我运行代码的最后一行 delayNode.connect(context.destination) 时崩溃。
  • 这是一段实际代码在调试模式下运行的视频YouTube Video
  • 这不是一个残酷的无限循环吗? osc -> 延迟 反馈然后延迟到目的地?
  • 感谢@jsantell 的回复,但这不是造成反馈延迟的方法吗?

标签: javascript google-chrome crash delay web-audio-api


【解决方案1】:

你有没有把平移节点放在延迟节点之后?

我遇到了类似的问题。
就我而言,这就像一个平移节点的错误。

调试了几个小时,发现这个页面:
http://lists.w3.org/Archives/Public/public-audio-dev/2013Oct/0000.html

它说延迟后连接panner节点会导致问题。
如果你的代码真的是这样,它就会崩溃。

var pannerNode = context.createPanner();
delayNode.connect(pannerNode);
pannerNode.connect(context.destination);

我的程序就像这段代码。 当我从程序中删除 panner 节点时,它运行良好。

所以如果你在同一个场合,你可以通过自己编写panner来避免这个问题。
这是我为我的程序编写的示例(在 CoffeeScript 中)。

class @Panner
constructor: (@ctx) ->
    @in = @ctx.createChannelSplitter(2)
    @out = @ctx.createChannelMerger(2)
    @l = @ctx.createGain()
    @r = @ctx.createGain()
    @in.connect(@l, 0)
    @in.connect(@r, 1)
    @l.connect(@out, 0, 0)
    @r.connect(@out, 0, 1)
    @setPosition(0.5)

connect: (dst) -> @out.connect(dst)

setPosition: (@pos) ->
    @l.gain.value = @pos
    @r.gain.value = 1.0 - @pos

我希望这会对你有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-02
    • 1970-01-01
    相关资源
    最近更新 更多