You may have noticed each demo includes a <chain-blam> with id="bus". I’ve created a many-to-one relationship by connecting other chains and instruments to this shared one. Spot all the out="bus" props.
The advantage of a mix bus is that multiple sources can share the same effects and effect parameters.
In this case, I have just an <analyser-blam> element and a newly introduced <saturator-blam>. The Analyser doesn’t actually affect the sound; it converts the signal into data for visualization. The Saturator really does affect the sound, though. Big style.
The <saturator-blam> element is an interface for a web audio WaveShaperNode. This node literally lets you shape the incoming waveform, mathematically, and is usually applied to create distortion. Here, the bombastic distorted beat you are hearing is brought to you by...
Math.tanh(x * a);
... where a represents the distortion amount. The element offers other algorithms via its mode prop. Each was created using trial and error because:
- I’m not a mathematician.
- Distortion should sound messed up and unruly, so all the better that I don’t know what I’m doing here.