Tone.js/examples/reverb.html

55 lines
1.6 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
2019-01-09 01:21:29 +00:00
<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>
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>
<tone-explanation label="Reverb">
<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.
<br><br>
Note: because of restrictions on iOS, 'generate' must be called from an explicit user action like a tap or click.
2019-01-09 01:21:29 +00:00
</tone-explanation>
2018-04-06 23:55:42 +00:00
2019-01-09 01:21:29 +00:00
<tone-content>
<tone-play-toggle disabled></tone-play-toggle>
<tone-reverb></tone-reverb>
</tone-content>
</tone-example>
<script type="text/javascript">
2018-04-06 23:55:42 +00:00
var reverb = new Tone.Reverb().toMaster();
2019-01-09 01:21:29 +00:00
reverb.generate().then(() => {
document.querySelector("tone-play-toggle").removeAttribute("disabled");
});
2018-04-06 23:55:42 +00:00
var player = new Tone.Player({
"url" : "./audio/FWDL.[mp3|ogg]",
"loop" : true
}).connect(reverb);
2019-01-09 01:21:29 +00:00
//bind the interface
document.querySelector("tone-play-toggle").bind(player);
document.querySelector("tone-reverb").bind(reverb);
2018-04-06 23:55:42 +00:00
</script>
</body>
</html>