Tone.js/examples/pingPongDelay.html
2014-03-13 12:47:26 -04:00

70 lines
No EOL
2.4 KiB
HTML

<html>
<head>
<title>Ping Pong Delay</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/AudioUnit.js"></script>
<script type="text/javascript" src="../src/components/Player.js"></script>
<script type="text/javascript" src="../src/components/Meter.js"></script>
<script type="text/javascript" src="../src/components/Envelope.js"></script>
<script type="text/javascript" src="../src/components/LFO.js"></script>
<script type="text/javascript" src="../src/components/Noise.js"></script>
<script type="text/javascript" src="../src/components/StereoSplit.js"></script>
<script type="text/javascript" src="../src/effects/Effect.js"></script>
<script type="text/javascript" src="../src/effects/FeedbackDelay.js"></script>
<script type="text/javascript" src="../src/effects/PingPongDelay.js"></script>
<script type="text/javascript" src="../src/components/Microphone.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.Bars.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.Meter.js"></script>
</head>
<body>
<style type="text/css">
#meter {
width: 100%;
text-align: center;
font-size: 10px;
}
</style>
<div id='Instructions'>Press 'e'</div>
<div id='meter'></div>
<script type="text/javascript">
var player = new AudioUnit.Player("../audio/A3.mp3");
var meter = new AudioUnit.Meter(2);
var env = new AudioUnit.Envelope(.01, .05, 0, 0);
var lfo = new AudioUnit.LFO(undefined, 1, .5, 1);
var noise = new AudioUnit.Noise();
var feedbackDelay = new AudioUnit.PingPongDelay(.25);
var bars = new AudioUnit.GUI.Bars(document.body);
// var meterGui = new WebAudio.GUI.Meter($("#meter")[0], meter);
noise.connect(env);
env.connect(feedbackDelay);
feedbackDelay.setFeedback(.5);
feedbackDelay.toSpeakers();
// feedbackDelay.connect(meter);
noise.setVolume(.4);
player.load(function(){
// player.loop(0, 0, 1);
player.loop();
});
setInterval(function(){
// var text = meter.getVolume(0).toFixed(3);
// text += " "+meter.getVolume(1).toFixed(3)
// $("#meter").html(text);
}, 100);
$(document).keydown(function(e){
if (e.which == 69){
env.triggerAttack();
} else if (e.which == 83) {
env.triggerRelease();
}
});
</script>
</body>
</html>