2014-04-04 17:07:16 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>SIGNAL PROCESSING</title>
|
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
<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">
|
2014-04-04 17:07:16 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-06-23 17:29:22 +00:00
|
|
|
<div>Process a signal through various methods to alter its value</div>
|
2014-04-16 00:05:11 +00:00
|
|
|
<br><br>
|
2014-04-04 18:36:01 +00:00
|
|
|
<input type='range' value='50'>
|
2014-04-04 17:07:16 +00:00
|
|
|
<div id='signal'>0</div>
|
|
|
|
<div id='add'>0</div>
|
|
|
|
<div id='scale'>0</div>
|
2014-04-16 20:47:25 +00:00
|
|
|
<div id='mult'>0</div>
|
2014-04-04 17:07:16 +00:00
|
|
|
<script type="text/javascript">
|
2014-04-16 20:47:25 +00:00
|
|
|
var signal = new Tone.Signal(0);
|
2014-04-16 00:05:11 +00:00
|
|
|
var dryMeter = new Tone.Meter();
|
|
|
|
signal.connect(dryMeter);
|
2014-04-04 17:07:16 +00:00
|
|
|
|
2014-06-15 20:40:41 +00:00
|
|
|
|
2014-04-16 00:05:11 +00:00
|
|
|
//the adder
|
|
|
|
var adder = new Tone.Add(100);
|
|
|
|
var addMeter = new Tone.Meter();
|
|
|
|
adder.connect(addMeter);
|
|
|
|
signal.connect(adder);
|
2014-06-15 20:40:41 +00:00
|
|
|
|
2014-04-16 00:05:11 +00:00
|
|
|
//the scaler
|
2014-04-16 23:56:18 +00:00
|
|
|
var scaler = new Tone.Scale(99, 101, 5, 10);
|
2014-04-16 00:05:11 +00:00
|
|
|
var scaleMeter = new Tone.Meter();
|
|
|
|
scaler.connect(scaleMeter);
|
2014-04-16 23:56:18 +00:00
|
|
|
adder.connect(scaler);
|
2014-04-16 00:05:11 +00:00
|
|
|
|
2014-04-16 20:47:25 +00:00
|
|
|
//the multiplier
|
|
|
|
var mult = new Tone.Multiply(10);
|
|
|
|
var multMeter = new Tone.Meter();
|
|
|
|
mult.connect(multMeter);
|
2014-04-16 23:56:18 +00:00
|
|
|
scaler.connect(mult);
|
2014-04-16 20:47:25 +00:00
|
|
|
|
2014-04-16 00:05:11 +00:00
|
|
|
//INTERFACE//
|
|
|
|
|
|
|
|
var $signal = document.querySelector("#signal");
|
|
|
|
var $add = document.querySelector("#add");
|
|
|
|
var $scale = document.querySelector("#scale");
|
2014-04-16 20:47:25 +00:00
|
|
|
var $mult = document.querySelector("#mult");
|
2014-04-16 00:05:11 +00:00
|
|
|
|
|
|
|
setInterval(function(){
|
2014-06-23 17:29:22 +00:00
|
|
|
$("#signal").text("signal: " + dryMeter.getValue().toFixed(3));
|
|
|
|
$("#add").text("signal + 100: " + addMeter.getValue().toFixed(3));
|
|
|
|
$("#scale").text("scaled 5 to 10: " + scaleMeter.getValue().toFixed(3));
|
|
|
|
$("#mult").text("signal * 10: " + multMeter.getValue().toFixed(3));
|
2014-04-16 00:05:11 +00:00
|
|
|
}, 100);
|
|
|
|
|
2014-06-23 17:29:22 +00:00
|
|
|
$("input").on("input", function(){
|
|
|
|
var val = $(this).val();
|
|
|
|
signal.linearRampToValueAtTime(val / 50 - 1, "+0.1");
|
|
|
|
});
|
2014-04-04 17:07:16 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|