mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 11:33:09 +00:00
linting
This commit is contained in:
parent
f6d6e310dd
commit
bdbc6dfccd
1 changed files with 42 additions and 43 deletions
|
@ -32,54 +32,53 @@
|
||||||
</tone-example>
|
</tone-example>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// the source
|
// the source
|
||||||
const player = new Tone.Player({
|
const player = new Tone.Player({
|
||||||
url: "https://tonejs.github.io/audio/berklee/femalevoice_oo_A4.mp3",
|
url: "https://tonejs.github.io/audio/berklee/femalevoice_oo_A4.mp3",
|
||||||
loop: true,
|
loop: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// make some effects
|
// make some effects
|
||||||
const chorus = new Tone.Chorus({
|
const chorus = new Tone.Chorus({
|
||||||
wet: 1,
|
wet: 1,
|
||||||
}).toDestination().start();
|
}).toDestination().start();
|
||||||
const chorusChannel = new Tone.Channel({ volume: -60 }).connect(chorus);
|
const chorusChannel = new Tone.Channel({ volume: -60 }).connect(chorus);
|
||||||
chorusChannel.receive("chorus");
|
chorusChannel.receive("chorus");
|
||||||
|
|
||||||
const cheby = new Tone.Chebyshev(50).toDestination();
|
const cheby = new Tone.Chebyshev(50).toDestination();
|
||||||
const chebyChannel = new Tone.Channel({ volume: -60 }).connect(cheby);
|
const chebyChannel = new Tone.Channel({ volume: -60 }).connect(cheby);
|
||||||
chebyChannel.receive("cheby");
|
chebyChannel.receive("cheby");
|
||||||
|
|
||||||
const reverb = new Tone.Reverb(3).toDestination();
|
const reverb = new Tone.Reverb(3).toDestination();
|
||||||
const reverbChannel = new Tone.Channel({ volume: -60 }).connect(reverb);
|
const reverbChannel = new Tone.Channel({ volume: -60 }).connect(reverb);
|
||||||
reverbChannel.receive("reverb");
|
reverbChannel.receive("reverb");
|
||||||
|
|
||||||
// send the player to all of the channels
|
// send the player to all of the channels
|
||||||
const playerChannel = new Tone.Channel().toDestination();
|
const playerChannel = new Tone.Channel().toDestination();
|
||||||
playerChannel.send("chorus");
|
playerChannel.send("chorus");
|
||||||
playerChannel.send("cheby");
|
playerChannel.send("cheby");
|
||||||
playerChannel.send("reverb");
|
playerChannel.send("reverb");
|
||||||
player.connect(playerChannel);
|
player.connect(playerChannel);
|
||||||
|
|
||||||
drawer().add({
|
|
||||||
tone: chorus,
|
|
||||||
}).add({
|
|
||||||
tone: reverb,
|
|
||||||
}).add({
|
|
||||||
tone: cheby,
|
|
||||||
});
|
|
||||||
document.querySelector("tone-play-toggle").addEventListener("start", () => player.start());
|
|
||||||
document.querySelector("tone-play-toggle").addEventListener("stop", () => player.stop());
|
|
||||||
// bind the interface
|
|
||||||
document.querySelector("[label=\"Chorus Send\"]").addEventListener("input", e => {
|
|
||||||
chorusChannel.volume.value = parseFloat(e.target.value);
|
|
||||||
});
|
|
||||||
document.querySelector("[label=\"Chebyshev Send\"]").addEventListener("input", e => {
|
|
||||||
chebyChannel.volume.value = parseFloat(e.target.value);
|
|
||||||
});
|
|
||||||
document.querySelector("[label=\"Reverb Send\"]").addEventListener("input", e => {
|
|
||||||
reverbChannel.volume.value = parseFloat(e.target.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
drawer().add({
|
||||||
|
tone: chorus,
|
||||||
|
}).add({
|
||||||
|
tone: reverb,
|
||||||
|
}).add({
|
||||||
|
tone: cheby,
|
||||||
|
});
|
||||||
|
document.querySelector("tone-play-toggle").addEventListener("start", () => player.start());
|
||||||
|
document.querySelector("tone-play-toggle").addEventListener("stop", () => player.stop());
|
||||||
|
// bind the interface
|
||||||
|
document.querySelector("[label=\"Chorus Send\"]").addEventListener("input", e => {
|
||||||
|
chorusChannel.volume.value = parseFloat(e.target.value);
|
||||||
|
});
|
||||||
|
document.querySelector("[label=\"Chebyshev Send\"]").addEventListener("input", e => {
|
||||||
|
chebyChannel.volume.value = parseFloat(e.target.value);
|
||||||
|
});
|
||||||
|
document.querySelector("[label=\"Reverb Send\"]").addEventListener("input", e => {
|
||||||
|
reverbChannel.volume.value = parseFloat(e.target.value);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue