Tone.js/examples/pingPongDelay.html

93 lines
2.9 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-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-14 15:28:35 +00:00
<script type="text/javascript" src="../src/GUI/GUI.ParamFader.js"></script>
<script type="text/javascript" src="../src/GUI/GUI.GainFader.js"></script>
2014-03-14 19:19:42 +00:00
<script type="text/javascript" src="../src/GUI/GUI.Compressor.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
}
2014-03-14 15:28:35 +00:00
#MasterOut {
width: 160px;
height: 200px;
position: absolute;
bottom: 10px;
right: 0px;
}
#Trigger {
width: 100px;
height: 100px;
position: absolute;
2014-03-15 02:54:56 +00:00
top: 50%;
left: 50%;
2014-03-14 15:28:35 +00:00
background-color: blue;
color: white;
}
2014-03-12 17:44:29 +00:00
</style>
2014-03-14 15:28:35 +00:00
<div id='Trigger'>Press</div>
<div id='MasterOut'>
<div id='meter'></div>
<div id='fader'></div>
</div>
2014-03-12 17:44:29 +00:00
<script type="text/javascript">
var meter = new AudioUnit.Meter(2);
2014-03-14 15:28:35 +00:00
var env = new AudioUnit.Envelope(.05, .01, 0, 0);
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);
2014-03-14 15:28:35 +00:00
var fader = new AudioUnit.GUI.GainFader($("#fader"), AudioUnit.Master.output, "mstr");
2014-03-14 19:19:42 +00:00
var compGui = new AudioUnit.GUI.Compressor($("body"), AudioUnit.Master.limiter);
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
2014-03-14 15:28:35 +00:00
$("#Trigger").bind("mousedown touchstart", function(e){
env.triggerAttack();
});
$("#Trigger").bind("mouseup touchend", function(e){
env.triggerRelease();
2014-03-12 17:44:29 +00:00
});
</script>
</body>
</html>