mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-02 15:08:42 +00:00
48 lines
No EOL
1.2 KiB
HTML
48 lines
No EOL
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<title>MERGE/SPLIT</title>
|
|
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id='mono'>0</div>
|
|
<div id='left'>0</div>
|
|
<div id='right'>0</div>
|
|
<script type="text/javascript">
|
|
|
|
//two signals into one (stereo) channel
|
|
var left = new Tone.Signal(-100);
|
|
var right = new Tone.Signal(75);
|
|
var mergeMeter = new Tone.Meter();
|
|
var merge = new Tone.Merge();
|
|
|
|
//connect it up
|
|
left.connect(merge.left);
|
|
right.connect(merge.right);
|
|
merge.connect(mergeMeter);
|
|
|
|
//one (stereo) signal split into two channels
|
|
var split = new Tone.Split();
|
|
merge.connect(split);
|
|
var rightMeter = new Tone.Meter();
|
|
var leftmeter = new Tone.Meter();
|
|
|
|
split.right.connect(rightMeter);
|
|
split.left.connect(leftmeter);
|
|
|
|
//INTERFACE//
|
|
|
|
var mono = document.querySelector("#mono");
|
|
var left = document.querySelector("#left");
|
|
var right = document.querySelector("#right");
|
|
|
|
setInterval(function(){
|
|
mono.textContent = "merged: " + mergeMeter.getValue(0).toFixed(3);
|
|
left.textContent = "left: " + rightMeter.getValue(0).toFixed(3);
|
|
right.textContent = "right: " + leftmeter.getValue(0).toFixed(3);
|
|
}, 100);
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html> |