Routing multiple effects in the Webaudio API

萝らか妹 提交于 2019-12-11 14:09:10

问题


this.source.connect(this.filter); // Filter set to eq value 200
this.source.connect(this.convolver);
this.source.connect(this.dry);
this.convolver.connect(this.wet); // Convolver is the actual convolver
this.filter.connect( context.destination );     
this.dry.connect(context.destination); // Dry is a gain (at 1)
this.wet.connect(context.destination); // Wet is a gain (at 1)

As soon as I wanted to add a filter things got utterly confusing. You can assume that the filters and everything are set up right. Individually tested they work fine. As it stands now however, everything works except the filter. Again, the filter alone works fine but I cant figure out how to route it properly.

I did have a look here: http://www.w3.org/TR/webaudio/#ModularRouting Though the example is a bit too complex for a starter like me.

How exactly do I route the filter to the rest and what do I have to consider when wanting to add more effects to the same dry and wet part of the audio file?.

Bonus: A nice "intermediate" graph would be awesome : ).


回答1:


In general, most "effects"-style routings need to be in series, not parallel. The way you have it routed, in the end the filtered signal is getting added to the unfiltered signal (routed through the convolver wet and dry routes). It will still have some effect, but that's probably not what you want; you probably want this:

this.source.connect(this.filter); // Filter set to eq value 200
this.filter.connect(this.convolver);
this.filter.connect(this.dry);
this.convolver.connect(this.wet); // Convolver is the actual convolver
this.dry.connect(context.destination); // Dry is a gain (at 1)
this.wet.connect(context.destination); // Wet is a gain (at 1)

Now, the wet/dry gains will balance between a convolved and unconvolved signal, but both will be filtered.



来源:https://stackoverflow.com/questions/34705558/routing-multiple-effects-in-the-webaudio-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!