Tone.js/examples/lfo.html

39 lines
733 B
HTML
Raw Normal View History

2014-03-15 03:17:18 +00:00
<html>
<head>
2014-03-15 03:30:00 +00:00
<title>LFO</title>
2014-03-15 03:17:18 +00:00
2014-06-21 19:54:20 +00:00
<script type="text/javascript" src="../Tone.js"></script>
2014-04-06 00:47:59 +00:00
2014-03-15 03:17:18 +00:00
</head>
<body>
<button onclick='startLFO()'>start</button>
2014-03-15 03:17:18 +00:00
<script type="text/javascript">
//components
var noise = new Tone.Noise("brown");
var lfo = new Tone.LFO("4n");
//connections
noise.toMaster();
lfo.connect(noise.output.gain);
//INTERFACE//
var button = document.querySelector("button");
2014-04-06 00:47:59 +00:00
var started = false;
2014-04-06 00:47:59 +00:00
//called when the start button is clicked
function startLFO(){
if (!started){
2014-04-06 00:47:59 +00:00
lfo.start();
2014-06-21 19:54:20 +00:00
noise.start();
button.textContent = "stop";
} else {
lfo.stop();
2014-06-21 19:54:20 +00:00
noise.stop();
button.textContent = "start";
}
started = !started;
}
2014-03-15 03:17:18 +00:00
</script>
</body>
</html>