Tone.js/examples/oscillator.html

58 lines
1.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oscillator</title>
2014-09-06 19:35:31 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
2014-08-28 04:39:17 +00:00
<script type="text/javascript" src="./deps/jquery.min.js"></script>
<script type="text/javascript" src="../build/Tone.js"></script>
2015-02-13 20:23:30 +00:00
<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>
2015-02-13 20:23:30 +00:00
<div id="Explanation">
Oscillator
<br>
<br>
An oscillator with an LFO attached to the detune control.
2014-08-28 04:39:17 +00:00
</div>
2015-02-13 20:23:30 +00:00
<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;
2015-02-13 20:23:30 +00:00
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();
}
});
2015-02-13 20:23:30 +00:00
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");
2014-08-28 04:39:17 +00:00
</script>
</body>
</html>