mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 12:03:12 +00:00
56 lines
1.7 KiB
HTML
56 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Reverb</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>
|
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>
|
|
<script src="../build/Tone.js"></script>
|
|
<script src="../../examples/dist/tone-gui.js"></script>
|
|
<script src="../../examples/dist/components.js"></script>
|
|
</head>
|
|
<body>
|
|
<style>
|
|
tone-play-toggle {
|
|
margin-bottom: 10px;
|
|
}
|
|
</style>
|
|
<tone-example label="Reverb">
|
|
<div slot="explanation">
|
|
<a href="https://tonejs.github.io/docs/Reverb">Tone.Reverb</a>
|
|
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>
|
|
|
|
<div id="content">
|
|
<tone-play-toggle></tone-play-toggle>
|
|
</div>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
var reverb = new Tone.Reverb().toDestination();
|
|
|
|
const player = new Tone.Player({
|
|
url: "https://tonejs.github.io/audio/berklee/shaker_slow_1.mp3",
|
|
loop: true,
|
|
volume: 6,
|
|
}).connect(reverb);
|
|
|
|
ui({
|
|
parent: document.querySelector('#content'),
|
|
tone: reverb
|
|
})
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-play-toggle").addEventListener('start', () => player.start())
|
|
document.querySelector("tone-play-toggle").addEventListener('stop', () => player.stop())
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|