在 Webaudio 中路由多种效果 API

Routing multiple effects in the Webaudio API

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)

当我想添加一个过滤器时,事情变得非常混乱。您可以假设过滤器和一切都设置正确。单独测试它们工作正常。然而,就目前而言,除过滤器外,一切正常。同样,过滤器单独工作正常,但我不知道如何正确路由它。

我确实看过这里:http://www.w3.org/TR/webaudio/#ModularRouting 虽然这个例子对于像我这样的初学者来说有点太复杂了。

我该如何将过滤器路由到其余部分?当我想为音频文件的相同干湿部分添加更多效果时,我需要考虑什么?。

奖金:一个漂亮的 "intermediate" 图表会很棒 :)。

一般来说,大多数"effects"风格的路由需要串联,而不是并联。按照您的路由方式,最终将过滤后的信号添加到未过滤的信号中(通过卷积器湿路由和干路由路由)。它仍然会有一些效果,但这可能不是你想要的;你可能想要这个:

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)

现在,wet/dry 增益将在卷积信号和非卷积信号之间保持平衡,但两者都将被过滤。