问题
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