mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
2cf69395ad
[skip ci]
139 lines
No EOL
3.4 KiB
HTML
139 lines
No EOL
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Buses</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
|
|
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
|
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
|
|
<script type="text/javascript" src="./scripts/draggabilly.js"></script>
|
|
<script type="text/javascript" src="./scripts/StartAudioContext.js"></script>
|
|
<script type="text/javascript" src="./scripts/Interface.js"></script>
|
|
<script type="text/javascript" src="./scripts/Logo.js"></script>
|
|
<script type="text/javascript" src="./scripts/qwerty-hancock.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/examples.css">
|
|
|
|
<script type="text/javascript">
|
|
// jshint ignore: start
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="Content">
|
|
<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
|
|
channel on your effect.
|
|
<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>.
|
|
</div>
|
|
<div id="Sliders"></div>
|
|
<div id="Keyboard"></div>
|
|
</div>
|
|
<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 autowahSend = synth.send("autowah", -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.9, 4000)
|
|
.receive("reverb")
|
|
.toMaster();
|
|
|
|
var autoWah = new Tone.AutoWah()
|
|
.receive("autowah")
|
|
.toMaster()
|
|
.set({
|
|
"baseFrequency" : 100,
|
|
"octaves" : 4,
|
|
"sensitivity" : 0,
|
|
"Q" : 2,
|
|
"gain" : 10,
|
|
"follower" : {
|
|
"attack" : 0.05,
|
|
"release" : 0.2
|
|
}
|
|
});
|
|
</script>
|
|
<script id="GUI" type="text/javascript">
|
|
$(function(){
|
|
|
|
new Interface.Slider({
|
|
name : "Chebyshev",
|
|
parent : $("#Sliders"),
|
|
drag : function(val){
|
|
chebySend.gain.value = val;
|
|
}
|
|
});
|
|
|
|
new Interface.Slider({
|
|
name : "Chorus",
|
|
parent : $("#Sliders"),
|
|
drag : function(val){
|
|
chorusSend.gain.value = val;
|
|
}
|
|
});
|
|
|
|
new Interface.Slider({
|
|
name : "Freeverb",
|
|
parent : $("#Sliders"),
|
|
drag : function(val){
|
|
reverbSend.gain.value = val;
|
|
}
|
|
});
|
|
|
|
new Interface.Slider({
|
|
name : "AutoWah",
|
|
parent : $("#Sliders"),
|
|
drag : function(val){
|
|
autowahSend.gain.value = val;
|
|
}
|
|
});
|
|
|
|
/**
|
|
* the keyboard
|
|
*/
|
|
var keyboard = new QwertyHancock({
|
|
id: "Keyboard",
|
|
width: $("#Content").width(),
|
|
height: 150,
|
|
octaves: Interface.isMobile ? 1.26 : 3,
|
|
startNote: "C3",
|
|
whiteKeyColour: "white",
|
|
blackKeyColour: "#f5871f",
|
|
activeColour : "#1EDF3E"
|
|
});
|
|
|
|
keyboard.keyDown = function (note, frequency) {
|
|
synth.triggerAttack(frequency);
|
|
};
|
|
|
|
keyboard.keyUp = function () {
|
|
synth.triggerRelease();
|
|
};
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |