mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 20:13:07 +00:00
34 lines
No EOL
675 B
HTML
34 lines
No EOL
675 B
HTML
<html>
|
|
<head>
|
|
<title>Oscillator</title>
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
|
<script type="text/javascript" src="../Tone.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="exampleStyle.css">
|
|
|
|
</head>
|
|
<body>
|
|
<div>start and stop a sawtooth wave</div>
|
|
<br>
|
|
<button>start</button>
|
|
<script type="text/javascript">
|
|
|
|
var osc = new Tone.Oscillator(440, "sawtooth");
|
|
|
|
//connect it to the output
|
|
osc.toMaster();
|
|
osc.setVolume(0.5);
|
|
|
|
$("button").mousedown(function(){
|
|
osc.start();
|
|
$(this).text("stop");
|
|
});
|
|
|
|
$("button").mouseup(function(){
|
|
osc.stop();
|
|
$(this).text("start");
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html> |