2014-04-04 17:07:16 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>SIGNAL PROCESSING</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../style/GUI.css">
|
|
|
|
|
|
|
|
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/core/Tone.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/signal/Signal.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/signal/Add.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/signal/Invert.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/signal/Normalize.js"></script>
|
|
|
|
<script type="text/javascript" src="../src/signal/Scale.js"></script>
|
|
|
|
|
2014-04-05 00:24:19 +00:00
|
|
|
<script type="text/javascript" src="../src/component/Meter.js"></script>
|
2014-04-04 17:07:16 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
</style>
|
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='invert'>0</div>
|
|
|
|
<div id='add'>0</div>
|
|
|
|
<div id='normalize'>0</div>
|
|
|
|
<div id='scale'>0</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var signal = new Tone.Signal();
|
|
|
|
var dryMeter = new Tone.Meter();
|
|
|
|
signal.connect(dryMeter);
|
|
|
|
|
|
|
|
//the inverter
|
|
|
|
var inverter = new Tone.Invert();
|
|
|
|
var invertMeter = new Tone.Meter();
|
|
|
|
inverter.connect(invertMeter);
|
|
|
|
signal.connect(inverter);
|
|
|
|
|
|
|
|
//the adder
|
|
|
|
var adder = new Tone.Add(100);
|
|
|
|
var addMeter = new Tone.Meter();
|
|
|
|
adder.connect(addMeter);
|
|
|
|
inverter.connect(adder);
|
|
|
|
|
|
|
|
//normalize back to -1 to 1
|
|
|
|
var norm = new Tone.Normalize(99, 101);
|
|
|
|
var normMeter = new Tone.Meter();
|
|
|
|
norm.connect(normMeter);
|
|
|
|
adder.connect(norm);
|
|
|
|
|
|
|
|
//the scaler
|
|
|
|
var scaler = new Tone.Scale(5, 10);
|
|
|
|
var scaleMeter = new Tone.Meter();
|
|
|
|
scaler.connect(scaleMeter);
|
|
|
|
norm.connect(scaler);
|
|
|
|
|
|
|
|
|
|
|
|
var $signal = $("#signal");
|
|
|
|
var $invert = $("#invert");
|
|
|
|
var $add = $("#add");
|
|
|
|
var $norm = $("#normalize");
|
|
|
|
var $scale = $("#scale");
|
|
|
|
|
|
|
|
setInterval(function(){
|
|
|
|
$signal.html("signal: " + dryMeter.getValue().toFixed(3));
|
|
|
|
$invert.html("inverted: " + invertMeter.getValue().toFixed(3));
|
|
|
|
$add.html("add 100: " + addMeter.getValue().toFixed(3));
|
|
|
|
$norm.html("normalized : "+normMeter.getValue().toFixed(3));
|
|
|
|
$scale.html("scaled 5 to 10: " + scaleMeter.getValue().toFixed(3));
|
|
|
|
/*$signal.html("signal: " + dryMeter.getValue());
|
|
|
|
$invert.html("incoming: " + );
|
|
|
|
$add.html("add 10: " + addMeter.getValue());*/
|
|
|
|
}, 100);
|
|
|
|
|
|
|
|
var range = $("input")[0];
|
|
|
|
range.onchange = function(){
|
|
|
|
var val = range.value;
|
|
|
|
var now = signal.now();
|
|
|
|
signal.linearRampToValueAtTime(val / 50 - 1, now + .1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// signal.toMaster();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|