Tone.js/examples/oscillator.html
2015-02-13 15:23:30 -05:00

58 lines
No EOL
1.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oscillator</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script type="text/javascript" src="./deps/jquery.min.js"></script>
<script type="text/javascript" src="../build/Tone.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">
Oscillator
<br>
<br>
An oscillator with an LFO attached to the detune control.
</div>
<div id="Content">
<div id="Rack"></div>
<div id="Code"></div>
</div>
<script id="ToneCode" type="text/javascript">
var osc = new Tone.Oscillator(440, "sine").toMaster();
osc.volume.value = -10;
var vibrato = new Tone.LFO(6, -25, 25)
.connect(osc.detune)
.start();
</script>
<script id="GUI" type="text/javascript">
Interface.Rack("Rack", "Oscillator");
Interface.Toggle("Rack", function(on){
if (on){
osc.start();
} else {
osc.stop();
}
});
Interface.DropDown("Rack", osc, "type", ["sine", "square", "triangle", "sawtooth"], "Oscillator Type");
Interface.DropDown("Rack", vibrato, "type", ["sine", "square", "triangle", "sawtooth"], "LFO Type");
Interface.Code("Code", "ToneCode");
</script>
</body>
</html>