mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
103 lines
No EOL
2.9 KiB
HTML
103 lines
No EOL
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>BUSES</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
|
<script type="text/javascript" src="../build/Tone.Preset.js"></script>
|
|
<script type="text/javascript" src="./deps/jquery.min.js"></script>
|
|
<script type="text/javascript" src="./deps/qwerty-hancock.js"></script>
|
|
<script type="text/javascript" src="./deps/nexusUI.js"></script>
|
|
<script type="text/javascript" src="./deps/prism.js"></script>
|
|
<script type="text/javascript" src="./scripts/Interface.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/examples.css">
|
|
<link rel="stylesheet" type="text/css" href="./style/prism.css">
|
|
|
|
<script type="text/javascript">
|
|
// jshint ignore: start
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="Explanation">
|
|
Buses
|
|
<br>
|
|
<br>
|
|
Buses allow you to send signal using named sends and receives. Sometimes
|
|
this is advantageous over directly connecting nodes for modularity and loose coupling.
|
|
</div>
|
|
<div id="Content">
|
|
<div id="KeyRack">
|
|
<div id="Keyboard"></div>
|
|
</div>
|
|
<div id="Rack"></div>
|
|
<div id="CodeBlock"></div>
|
|
</div>
|
|
<script id="ToneCode" type="text/javascript">
|
|
//the dry signal which goes to the master output
|
|
var dry = Tone.context.createGain()
|
|
.toMaster();
|
|
|
|
//the synth
|
|
var synth = new Tone.MonoSynth()
|
|
.setPreset("Barky")
|
|
.connect(dry);
|
|
|
|
//need to force the single channel synth
|
|
//signal a stereo signal for the the chorus
|
|
var mono = new Tone.Mono();
|
|
synth.connect(mono);
|
|
|
|
var chorusSend = mono.send("chorus", 0);
|
|
var chebySend = synth.send("cheby", 0);
|
|
var autowahSend = synth.send("autowah", 0);
|
|
|
|
//make some effects
|
|
var chorus = new Tone.Chorus()
|
|
.receive("chorus")
|
|
.setPreset("ether")
|
|
.toMaster();
|
|
var cheby = new Tone.Chebyshev(50)
|
|
.receive("cheby")
|
|
.toMaster();
|
|
var autoWah = new Tone.AutoWah()
|
|
.receive("autowah")
|
|
.setPreset("talker")
|
|
.toMaster();
|
|
</script>
|
|
<script id="gui" type="text/javascript">
|
|
|
|
Interface.Rack("KeyRack", "MonoSynth");
|
|
Interface.Rack("Rack", "Sends");
|
|
var keyboard = new QwertyHancock({
|
|
id: "Keyboard",
|
|
width: $("#KeyRack").width(),
|
|
height: 75,
|
|
octaves : 3,
|
|
startNote: "A2",
|
|
});
|
|
keyboard.keyDown = function(note, freq){
|
|
synth.triggerAttack(freq);
|
|
};
|
|
keyboard.keyUp = function(){
|
|
synth.triggerRelease();
|
|
};
|
|
Interface.HorizontalSlider("Rack", dry, "gain", 0, 1, 2).label = "dry";
|
|
var chorusSlider = Interface.HorizontalSlider("Rack", chorusSend, "gain");
|
|
var chebySlider = Interface.HorizontalSlider("Rack", chebySend, "gain");
|
|
var autoSlider = Interface.HorizontalSlider("Rack", autowahSend, "gain");
|
|
chorusSlider.label = "chorus";
|
|
chebySlider.label = "chebyshev";
|
|
autoSlider.label = "autowah";
|
|
chorusSlider.draw();
|
|
chebySlider.draw();
|
|
autoSlider.draw();
|
|
Interface.Code("CodeBlock", "ToneCode");
|
|
|
|
</script>
|
|
</body>
|
|
</html> |