Tone.js/examples/bitCrush.html

37 lines
669 B
HTML
Raw Normal View History

2014-04-02 20:09:02 +00:00
<html>
<head>
<title>Bit Crush</title>
<script type="text/javascript" src='../build/Tone.js'></script>
2014-04-02 20:09:02 +00:00
</head>
<body>
<button onclick='startOsc()'>start</button>
2014-04-02 20:09:02 +00:00
<script type="text/javascript">
//components
var sine = new Tone.Oscillator();
var crusher = new Tone.BitCrusher(5);
//connections
sine.connect(crusher);
crusher.toMaster();
2014-04-02 20:09:02 +00:00
//INTERFACE//
2014-04-02 20:09:02 +00:00
var button = document.querySelector("button");
2014-04-02 20:09:02 +00:00
//called when the start button is clicked
function startOsc(){
if (!sine.started){
sine.start();
button.textContent = "stop";
} else {
sine.stop();
button.textContent = "start";
}
}
2014-04-06 00:47:59 +00:00
2014-04-02 20:09:02 +00:00
</script>
</body>
</html>