Tone.js/examples/reverb.html
2019-01-08 20:21:29 -05:00

54 lines
1.6 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>
<script src="../build/Tone.js"></script>
<script src="./js/tonejs-ui.js"></script>
</head>
<body>
<style>
tone-play-toggle {
margin-bottom: 10px;
}
</style>
<tone-example>
<tone-explanation label="Reverb">
<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.
<br><br>
Note: because of restrictions on iOS, 'generate' must be called from an explicit user action like a tap or click.
</tone-explanation>
<tone-content>
<tone-play-toggle disabled></tone-play-toggle>
<tone-reverb></tone-reverb>
</tone-content>
</tone-example>
<script type="text/javascript">
var reverb = new Tone.Reverb().toMaster();
reverb.generate().then(() => {
document.querySelector("tone-play-toggle").removeAttribute("disabled");
});
var player = new Tone.Player({
"url" : "./audio/FWDL.[mp3|ogg]",
"loop" : true
}).connect(reverb);
//bind the interface
document.querySelector("tone-play-toggle").bind(player);
document.querySelector("tone-reverb").bind(reverb);
</script>
</body>
</html>