Tone.js/examples/oscillator.html

77 lines
No EOL
1.7 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="./deps/jquery-ui.js"></script>
<script type="text/javascript" src="./deps/jquery.ui.touch-punch.js"></script>
<script type="text/javascript" src="../build/Tone.js"></script>
<script type="text/javascript" src="./Widgets.js"></script>
<script type="text/javascript" src="./ExampleList.js"></script>
<link rel="stylesheet" type="text/css" href="./style/widgets.css">
<link rel="stylesheet" type="text/css" href="./style/jquery-ui.css">
</head>
<body>
<div id="Container">
<div id="Explanation">
Oscillator
<br>
<br>
An oscillator with an LFO attached to the detune control.
</div>
<div id="Content">
</div>
</div>
<script type="text/javascript">
/* global Tone, GUI*/
var osc = new Tone.Oscillator(440, "sine");
var vibrato = new Tone.LFO(6, -25, 25);
vibrato.start();
//connect it to the output
osc.toMaster();
osc.setVolume(-10);
vibrato.connect(osc.detune);
// GUI //
$(function(){
var content = $("#Content");
new GUI.TopBar(Tone);
new GUI.Checkbox(content, function(on){
if (on){
osc.start();
} else {
osc.stop();
}
}, "start", "stop");
new GUI.Oscillator(content, osc, "oscillator");
new GUI.Oscillator(content, vibrato.oscillator, "vibrato osc");
});
</script>
<style type="text/css">
#Content {
text-align: left;
height: 110px;
width: 240px;
}
.Checkbox {
width: 100%;
}
.Oscillator {
margin-top: 10px;
}
</style>
</body>
</html>