Tone.js/examples/buses.html

112 lines
2.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-09-04 04:32:54 +00:00
<html>
<head>
<meta charset="utf-8">
2015-06-26 05:23:05 +00:00
<title>Buses</title>
2014-09-06 19:35:31 +00:00
2015-06-27 22:10:18 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
2015-12-08 05:06:58 +00:00
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
2014-09-04 04:32:54 +00:00
<script src="../build/Tone.js"></script>
<script src="./scripts/jquery.min.js"></script>
<script src="./scripts/draggabilly.js"></script>
<script src="./scripts/StartAudioContext.js"></script>
<script src="./scripts/Interface.js"></script>
<script src="https://tonejs.github.io/Logo/build/Logo.js"></script>
<script src="./scripts/Keyboard.js"></script>
2015-02-12 03:39:28 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script>
2015-02-12 03:39:28 +00:00
// jshint ignore: start
</script>
2014-09-04 04:32:54 +00:00
</head>
<body>
2015-02-12 03:39:28 +00:00
<div id="Content">
2015-06-26 05:23:05 +00:00
<div id="Title">Buses</div>
<div id="Explanation">
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
2016-10-05 14:24:07 +00:00
channel on your effect. The gain values are all in decibels.
2015-06-27 22:02:55 +00:00
<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>.
2014-09-04 04:32:54 +00:00
</div>
2015-06-26 05:23:05 +00:00
<div id="Sliders"></div>
<div id="Keyboard"></div>
2014-09-04 04:32:54 +00:00
</div>
<script>
2014-09-04 04:32:54 +00:00
2015-02-12 03:39:28 +00:00
//the synth
var synth = new Tone.Synth().toMaster()
2015-06-26 05:23:05 +00:00
.set("envelope.attack", 0.04);
2014-09-04 04:32:54 +00:00
2015-06-26 05:23:05 +00:00
//send audio to each of the effect channels
var chorusSend = synth.send("chorus", -Infinity);
var chebySend = synth.send("cheby", -Infinity);
var autowahSend = synth.send("autowah", -Infinity);
var reverbSend = synth.send("reverb", -Infinity);
2014-09-04 04:32:54 +00:00
//make some effects
2015-02-12 03:39:28 +00:00
var chorus = new Tone.Chorus()
.receive("chorus")
.toMaster();
2015-06-26 05:23:05 +00:00
2015-02-12 03:39:28 +00:00
var cheby = new Tone.Chebyshev(50)
.receive("cheby")
.toMaster();
2015-06-26 05:23:05 +00:00
var reverb = new Tone.Freeverb(0.8, 4000)
2015-06-26 05:23:05 +00:00
.receive("reverb")
.toMaster();
2017-03-26 20:39:19 +00:00
// GUI //
Interface.Slider({
name : "Chebyshev",
parent : $("#Sliders"),
min : -100,
max : 0,
drag : function(val){
chebySend.gain.value = val;
}
2014-09-04 04:32:54 +00:00
});
2017-03-26 20:39:19 +00:00
Interface.Slider({
name : "Chorus",
parent : $("#Sliders"),
min : -100,
max : 0,
drag : function(val){
chorusSend.gain.value = val;
}
});
Interface.Slider({
name : "Freeverb",
parent : $("#Sliders"),
min : -100,
max : 0,
drag : function(val){
reverbSend.gain.value = val;
}
});
/**
* the keyboard
*/
var keyboard = Interface.Keyboard();
keyboard.keyDown = function (note) {
synth.triggerAttack(note);
};
keyboard.keyUp = function () {
synth.triggerRelease();
};
2014-09-04 04:32:54 +00:00
</script>
</body>
</html>