Tone.js/examples/oscillator.html

77 lines
1.7 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="./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>
2014-08-28 04:39:17 +00:00
<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>
2014-08-28 04:39:17 +00:00
<div id="Container">
<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>
<div id="Content">
</div>
</div>
<script type="text/javascript">
2014-08-28 04:39:17 +00:00
/* global Tone, GUI*/
var osc = new Tone.Oscillator(440, "sine");
var vibrato = new Tone.LFO(6, -25, 25);
2014-08-28 04:39:17 +00:00
vibrato.start();
//connect it to the output
osc.toMaster();
2014-09-02 16:10:10 +00:00
osc.setVolume(-10);
vibrato.connect(osc.detune);
2014-08-28 04:39:17 +00:00
// GUI //
2014-08-28 04:39:17 +00:00
$(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");
});
2014-08-28 04:39:17 +00:00
</script>
2014-08-28 04:39:17 +00:00
<style type="text/css">
#Content {
text-align: left;
height: 110px;
2014-09-02 16:10:10 +00:00
width: 240px;
2014-08-28 04:39:17 +00:00
}
.Checkbox {
width: 100%;
}
.Oscillator {
margin-top: 10px;
}
</style>
</body>
</html>