Tone.js/examples/lfo.html
2014-06-21 15:55:15 -04:00

39 lines
No EOL
733 B
HTML

<html>
<head>
<title>LFO</title>
<script type="text/javascript" src="../Tone.js"></script>
</head>
<body>
<button onclick='startLFO()'>start</button>
<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");
var started = false;
//called when the start button is clicked
function startLFO(){
if (!started){
lfo.start();
noise.start();
button.textContent = "stop";
} else {
lfo.stop();
noise.stop();
button.textContent = "start";
}
started = !started;
}
</script>
</body>
</html>