mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
55 lines
No EOL
1 KiB
HTML
55 lines
No EOL
1 KiB
HTML
<html>
|
|
<head>
|
|
<title>AUTOPANNER</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>Auto Panner</div>
|
|
<br>
|
|
<button>start</button>
|
|
<div id='left'>0</div>
|
|
<div id='right'>0</div>
|
|
<script type="text/javascript">
|
|
|
|
//panner
|
|
var pan = new Tone.AutoPanner();
|
|
|
|
//input signals
|
|
var sine = new Tone.Oscillator();
|
|
|
|
//connect it up
|
|
sine.connect(pan);
|
|
pan.toMaster();
|
|
|
|
//meter
|
|
var meter = new Tone.Meter(2);
|
|
pan.connect(meter);
|
|
|
|
//star the panner lfo
|
|
pan.start();
|
|
pan.setDry(0);
|
|
|
|
//update the meters
|
|
setInterval(function(){
|
|
$("#left").text("left: " + meter.getDb(0).toFixed(2) + " db");
|
|
$("#right").text("right: " + meter.getDb(1).toFixed(2) + " db");
|
|
}, 100);
|
|
|
|
|
|
$("button").click(function(){
|
|
if (sine.state !== "started"){
|
|
sine.start();
|
|
$(this).text("stop");
|
|
} else {
|
|
sine.stop();
|
|
$(this).text("stop");
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html> |