2014-06-23 17:29:22 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Oscillator</title>
|
|
|
|
|
2014-08-28 04:39:17 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=0.5">
|
|
|
|
|
|
|
|
<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>
|
2014-06-23 17:29:22 +00:00
|
|
|
<script type="text/javascript" src="../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">
|
2014-06-23 17:29:22 +00:00
|
|
|
|
|
|
|
</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. Set the Oscillilator
|
|
|
|
type and the LFO Amount.
|
|
|
|
</div>
|
|
|
|
<div id="Content">
|
|
|
|
</div>
|
|
|
|
</div>
|
2014-06-23 17:29:22 +00:00
|
|
|
<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(4, -20, 20);
|
|
|
|
vibrato.start();
|
|
|
|
|
|
|
|
var vibratoAmount = new Tone.Multiply(1);
|
2014-06-23 17:29:22 +00:00
|
|
|
|
|
|
|
//connect it to the output
|
|
|
|
osc.toMaster();
|
2014-08-28 04:39:17 +00:00
|
|
|
osc.setVolume(-6);
|
|
|
|
vibrato.connect(vibratoAmount);
|
|
|
|
vibratoAmount.connect(osc.detune);
|
|
|
|
|
|
|
|
// GUI //
|
2014-06-23 17:29:22 +00:00
|
|
|
|
2014-08-28 04:39:17 +00:00
|
|
|
$(function(){
|
|
|
|
var content = $("#Content");
|
|
|
|
new GUI.StartButton(Tone.startMobile);
|
|
|
|
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");
|
|
|
|
//vibrato controls
|
|
|
|
$("<div>", {"id" : "VibLabel"}).appendTo(content).text("vibrato controls");
|
|
|
|
new GUI.Oscillator(content, vibrato.oscillator, "vibrato osc");
|
|
|
|
$("<div>", {"class" : "Slider"}).slider({
|
|
|
|
"min" : 0,
|
|
|
|
"max" : 100,
|
|
|
|
"value" : 100,
|
|
|
|
"range" : "min",
|
|
|
|
"slide" : function(e, ui){
|
|
|
|
vibratoAmount.setValue(ui.value / 100);
|
|
|
|
label.setValue(ui.value / 100);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(content);
|
|
|
|
var label = new GUI.Value(content, "1", "vibrato amount");
|
2014-06-23 17:29:22 +00:00
|
|
|
});
|
2014-08-28 04:39:17 +00:00
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
|
|
|
|
</script>
|
2014-08-28 04:39:17 +00:00
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
#Content {
|
|
|
|
text-align: left;
|
|
|
|
height: 210px;
|
|
|
|
}
|
|
|
|
#VibLabel {
|
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
height: 10px;
|
|
|
|
margin-top: 20px;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.Checkbox {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.Oscillator {
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
.Slider {
|
|
|
|
margin-top: 20px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
.Value {
|
|
|
|
margin-top: 10px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
</style>
|
2014-06-23 17:29:22 +00:00
|
|
|
</body>
|
|
|
|
</html>
|