Web Audio APIのdelayがクラッシュする話(追記)

情報欲しいから英語でも書く

These days I'm developing evil, adding features to make it better, practical enough to play music live.

Today I happened to have a problem with delayNode, one of Web Audio API components.

I wanted to implement typical delay effect node, which has params: "delay", "feedback", "lofi", "input", "output". The code is as follows.

Delay effect in Web Audio API, but it kills Chrome ...

Problem: Google Chrome crashes on inserting this effect to synths.

evil is an DAW application like ableton live. I've implemented features to insert effects for master track, and now trying to give it to each synth tracks.

When I put this effect node to synths, my Chrome dies and turn blue saying "error" and dev tools says "Inspected target crashed", Although putting this to master track makes no problem.

I found a similar case on stackoverflow.com.

javascript - Web Audio API Delay With Feedback Crashing Chrome - Stack Overflow

This QA hasn't reached the solution yet, but it guesses that the problem is caused by the feedback loop. Actually it works fine when I remove feedback node.

Is feedback loop prohibited? It's common feature for delay effect... (and it works on some cases, as I said above...)

If you have some information, please tell me. Thx.

<added>

I found a solution!

feedback loop seems to crash panner node. from Casper Schipper on 2013-10-03 (public-audio-dev@w3.org from October 2013)

According to this source, the cause of the problem is putting pannner nodes after the delay node. The author suggests implementing alternative panner.

I wrote a panner as follows.

Panner node alternative for Web Audio API

works fine!

Default panner node is for 3d games, rather than for music application... it also requires position as vec3. It might be better that writing custom panner node for features exactly what you need.

</added>

最近evilを開発してて、機能追加してる。

今日ディレイを実装してたら問題にぶちあったった。

作りたいのはごく普通のディレイ。コードはこんな感じ。

Delay effect in Web Audio API, but it kills Chrome ...

このエフェクトをシンセにつなぐと、Google Chromeがクラッシュする。!!!!!!!

evilableton liveのパチモンのDAWアプリだ。マスタートラックにエフェクト追加するのはもう出来てて(手元では)ちゃんと動いてる。それで今はシンセ毎にエフェクト追加する機能を作ってる。

シンセにこのエフェクトを追加すると、Chromeが青いエラー画面になって、dev toolsには"Inspected target crashed"って言われる。マスタートラックに同じエフェクト追加したらちゃんと動くのに……

stackoverflow.comで同様の問題に遭遇してる人がいた。

javascript - Web Audio API Delay With Feedback Crashing Chrome - Stack Overflow

結局解決してないみたい。でも、feedbackのために信号が無限ループしてるのが原因じゃない?って言われてる。 確かにfeedbackループ取り除くと無事動く。

feedbackループは禁止ってことなのかな?feedbackは極普通の機能なのに…… (動く場合と動かない場合があるのも謎だし…)

なんか情報あったら教えて下さい。

<追記>

自己解決しました。 同じ問題にあたった人がいた。

feedback loop seems to crash panner node. from Casper Schipper on 2013-10-03 (public-audio-dev@w3.org from October 2013)

どうやら、feedbackループしてるdelayの後にpannerノードつないだらクラッシュするみたい。 この人は自分でpanner書いて対処したって言ってる。

僕も自分で書いてみた。

Panner node alternative for Web Audio API

ちゃんと動いてる!

Web Audio APIのデフォのpannerはこんな問題もあるし、位置の指定をvec3で与える必要あったり、センター定位付近でめっちゃノイズのったりして微妙。少なくとも音楽アプリ向きでは無さそう。

必要に応じて自分でpanner書いたほうが良さそう。

</追記>