Tone.js/examples/reverb.html

57 lines
1.7 KiB
HTML
Raw Normal View History

2018-04-06 23:55:42 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Reverb</title>
2019-01-09 01:21:29 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/png" sizes="174x174" href="./favicon.png">
2018-04-06 23:55:42 +00:00
2020-07-18 00:58:09 +00:00
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>
2019-01-09 01:21:29 +00:00
<script src="../build/Tone.js"></script>
2020-07-18 00:58:09 +00:00
<script src="./js/tone-ui.js"></script>
<script src="./js/components.js"></script>
2018-04-06 23:55:42 +00:00
</head>
<body>
2019-01-09 01:21:29 +00:00
<style>
tone-play-toggle {
margin-bottom: 10px;
}
</style>
<tone-example label="Reverb">
<div slot="explanation">
2019-01-09 01:21:29 +00:00
<a href="https://tonejs.github.io/docs/Reverb">Tone.Reverb</a>
2018-04-06 23:55:42 +00:00
is a convolution-based reverb. An impulse response is created with a
decaying noise burst when you click 'Generate Reverb'. The 'Decay Time' controls
how long the noise burst lasts. If the 'Decay Time' is changed, a new noise burst
will need to be generated.
</div>
2018-04-06 23:55:42 +00:00
<div id="content">
<tone-play-toggle></tone-play-toggle>
</div>
2019-01-09 01:21:29 +00:00
</tone-example>
<script type="text/javascript">
2020-07-19 00:20:19 +00:00
const reverb = new Tone.Reverb().toDestination();
2018-04-06 23:55:42 +00:00
const player = new Tone.Player({
url: "https://tonejs.github.io/audio/berklee/shaker_slow_1.mp3",
loop: true,
volume: 6,
2018-04-06 23:55:42 +00:00
}).connect(reverb);
ui({
2020-07-19 00:20:19 +00:00
parent: document.querySelector("#content"),
tone: reverb
2020-07-19 00:20:19 +00:00
});
2020-07-19 00:20:19 +00:00
// bind the interface
document.querySelector("tone-play-toggle").addEventListener("start", () => player.start());
document.querySelector("tone-play-toggle").addEventListener("stop", () => player.stop());
2018-04-06 23:55:42 +00:00
</script>
</body>
</html>