<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Buses</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link rel="icon" type="image/png" sizes="174x174" href="./favicon.png"> <script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script> <script src="../build/Tone.js"></script> <script src="./js/tonejs-ui.js"></script> <style> tone-content tone-slider { display: block; margin-top: 10px; } </style> </head> <body> <tone-example> <tone-explanation label="Buses"> Buses make it easy to share effects across many instruments. <code>send</code> audio to a named bus from an instrument and then <code>receive</code> that channel on your effect. The gain values are all in decibels. <br><br> Docs on <a href="https://tonejs.github.io/docs/Tone.send">send</a> and <a href="https://tonejs.github.io/docs/Tone.receive">receive</a>. </tone-explanation> <tone-content> <tone-piano></tone-piano> <tone-slider label="Chorus Send" min="-100" max="0" value="-100" units="db"></tone-slider> <tone-slider label="Chebyshev Send" min="-100" max="0" value="-100" units="db"></tone-slider> <tone-slider label="Freeverb Send" min="-100" max="0" value="-100" units="db"></tone-slider> </tone-content> <tone-drawer collapsed> <tone-chorus collapsed></tone-chorus> <tone-chebyshev collapsed></tone-chebyshev> <tone-freeverb collapsed></tone-freeverb> <tone-synth collapsed></tone-synth> </tone-drawer> </tone-example> <script type="text/javascript"> //the synth var synth = new Tone.Synth().toMaster().set("envelope.attack", 0.04); //send audio to each of the effect channels var chorusSend = synth.send("chorus", -Infinity); var chebySend = synth.send("cheby", -Infinity); var reverbSend = synth.send("reverb", -Infinity); //make some effects var chorus = new Tone.Chorus() .receive("chorus") .toMaster(); var cheby = new Tone.Chebyshev(50) .receive("cheby") .toMaster(); var reverb = new Tone.Freeverb(0.8, 4000) .receive("reverb") .toMaster(); //bind the interface document.querySelector("tone-chorus").bind(chorus); document.querySelector("tone-chebyshev").bind(cheby); document.querySelector("tone-freeverb").bind(reverb); document.querySelector("tone-synth").bind(synth); document.querySelector("tone-piano").bind(synth); document.querySelector("[label=\"Chorus Send\"]").addEventListener("change", e => { chorusSend.gain.value = e.detail; }); document.querySelector("[label=\"Chebyshev Send\"]").addEventListener("change", e => { chebySend.gain.value = e.detail; }); document.querySelector("[label=\"Freeverb Send\"]").addEventListener("change", e => { reverbSend.gain.value = e.detail; }); </script> </body> </html>