Tone.js/examples/convolver.html
2014-10-28 12:18:06 -04:00

94 lines
No EOL
2.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script type="text/javascript" src="./deps/jquery.min.js"></script>
<script type="text/javascript" src="./deps/jquery-ui.js"></script>
<script type="text/javascript" src="./deps/jquery.ui.touch-punch.js"></script>
<script type="text/javascript" src="../build/Tone.js"></script>
<script type="text/javascript" src="./Widgets.js"></script>
<script type="text/javascript" src="./ExampleList.js"></script>
<link rel="stylesheet" type="text/css" href="./style/widgets.css">
<link rel="stylesheet" type="text/css" href="./style/jquery-ui.css">
</head>
<body>
<div id="Container">
<div id="Explanation">
Convolver
<br>
<br>
Press START to hear a note through a Convolution reverb effect.
The Berlin tunnel impulse response courtesy of Gabe Liberti, <a href="http://www.studioindefinit.com/" target="_blank">Studio Indefinit</a>.
</div>
<div id="Content">
<div id="Loading">Loading...</div>
</div>
</div>
<script type="text/javascript">
/* globals Tone, GUI */
var loadCount = 0;
function testLoad(){
loadCount++;
if (loadCount === 2){
$("#Loading").remove();
}
}
var player = new Tone.Player("./audio/casio/A1.mp3", function(){
testLoad();
});
player.retrigger = true;
var convolver = new Tone.Convolver({
url : "./audio/IRs/berlin_tunnel_ir.wav",
onload : function(){
testLoad();
},
});
//Effects sends and returns
player.connect(convolver);
convolver.toMaster();
// GUI //
new GUI.TopBar(Tone);
var container = $("#Content");
// Momentary play
new GUI.Momentary(container, function(on){
if (on){
player.start();
}
}, "Start", "Start");
// dryWet slider
var wetnessSlider = new GUI.Slider(container, function(val){
convolver.setWet(val, 0);
return val*100;
}, 1, "dry/wet", "%");
wetnessSlider.render(1);
</script>
<style type="text/css">
#Content {
width: 300px;
height: 300px;
text-align: center;
}
.Slider{
margin-top: 10px;
width: 100%;
}
</style>
</body>
</html>