Tone.js/examples/pingPongDelay.html

78 lines
2.6 KiB
HTML
Raw Normal View History

2014-03-12 17:44:29 +00:00
<html>
<head>
<title>Ping Pong Delay</title>
<link rel="stylesheet" type="text/css" href="../style/GUI.css">
2014-03-12 17:44:29 +00:00
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
2014-03-12 20:29:43 +00:00
<script type="text/javascript" src="../src/core/AudioUnit.js"></script>
2014-03-14 00:03:14 +00:00
<script type="text/javascript" src="../src/core/Master.js"></script>
2014-03-12 17:44:29 +00:00
<script type="text/javascript" src="../src/components/Meter.js"></script>
2014-03-14 00:03:14 +00:00
<script type="text/javascript" src="../src/components/Player.js"></script>
2014-03-12 17:44:29 +00:00
<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>
2014-03-14 00:03:14 +00:00
<script type="text/javascript" src="../src/GUI/GUI.Bar.js"></script>
2014-03-12 17:44:29 +00:00
<script type="text/javascript" src="../src/GUI/GUI.Meter.js"></script>
2014-03-14 00:03:14 +00:00
<script type="text/javascript" src="../src/GUI/GUI.Fader.js"></script>
2014-03-12 17:44:29 +00:00
</head>
<body>
<style type="text/css">
#meter {
2014-03-14 00:03:14 +00:00
width: auto;
2014-03-12 17:44:29 +00:00
text-align: center;
2014-03-14 00:03:14 +00:00
float: right;
position: absolute;
bottom: 10px;
right: 10px;
}
#fader {
position: absolute;
bottom: 10px;
right: 100px;
width: auto;
2014-03-12 17:44:29 +00:00
}
</style>
<div id='Instructions'>Press 'e'</div>
<div id='meter'></div>
2014-03-14 00:03:14 +00:00
<div id='fader'></div>
2014-03-12 17:44:29 +00:00
<script type="text/javascript">
2014-03-12 20:29:43 +00:00
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);
2014-03-14 00:03:14 +00:00
var meterGui = new AudioUnit.GUI.Meter($("#meter"), meter, "master", 20);
var fader = new AudioUnit.GUI.Fader($("#fader"), 0, 20, "master gain", 20);
2014-03-12 17:44:29 +00:00
noise.connect(env);
2014-03-12 17:44:29 +00:00
env.connect(feedbackDelay);
feedbackDelay.setFeedback(.5);
2014-03-14 00:03:14 +00:00
feedbackDelay.toMaster();
2014-03-12 17:44:29 +00:00
2014-03-14 00:03:14 +00:00
//the master output meter
AudioUnit.Master.connect(meter);
2014-03-12 17:44:29 +00:00
player.load(function(){
// player.loop(0, 0, 1);
player.loop();
});
$(document).keydown(function(e){
if (e.which == 69){
env.triggerAttack();
} else if (e.which == 83) {
env.triggerRelease();
}
});
</script>
</body>
</html>