mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 20:13:07 +00:00
58 lines
1.7 KiB
HTML
58 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Ping Pong Delay</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
|
|
|
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
|
|
<script src="../build/Tone.js"></script>
|
|
<script src="./js/tonejs-ui.js"></script>
|
|
<style type="text/css">
|
|
tone-trigger, tone-meter {
|
|
margin-bottom: 10px;
|
|
}
|
|
tone-meter {
|
|
background-color: black;
|
|
height: 100px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<tone-example>
|
|
<tone-loader></tone-loader>
|
|
|
|
<tone-explanation label="Ping Pong Delay">
|
|
A Ping Pong Delay is a stereo feedback delay where the delay bounces back and forth between the left and right channels. Hit the button to trigger a snare sample into the effect.
|
|
<br><br>
|
|
<a href="https://tonejs.github.io/docs/PingPongDelay">Tone.PingPongDelay</a> docs.
|
|
</tone-explanation>
|
|
|
|
<tone-content>
|
|
<tone-meter stereo></tone-meter>
|
|
<tone-trigger></tone-trigger>
|
|
<tone-ping-pong-delay></tone-ping-pong-delay>
|
|
</tone-content>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
//the feedback delay
|
|
var feedbackDelay = new Tone.PingPongDelay({
|
|
"delayTime" : "8n",
|
|
"feedback" : 0.6,
|
|
"wet" : 0.5
|
|
}).toMaster();
|
|
|
|
//play a snare sound through it
|
|
var player = new Tone.Player("./audio/505/snare.[mp3|ogg]").connect(feedbackDelay);
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-trigger").bind(player);
|
|
document.querySelector("tone-ping-pong-delay").bind(feedbackDelay);
|
|
document.querySelector("tone-meter").bind(feedbackDelay);
|
|
</script>
|
|
</body>
|
|
</html>
|