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

59 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Analyser</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-oscilloscope, tone-fft {
width: 100%;
height: 44px;
border-radius: 22px;
background-color: black;
}
</style>
<tone-example>
<tone-loader></tone-loader>
<tone-explanation label="Analyser">
<a href="https://tonejs.github.io/docs/FFT" target="_blank">Tone.FFT</a>
returns the amplitude of the incoming signal at different frequencies.
<a href="https://tonejs.github.io/docs/FFT" target="_blank">Tone.Waveform</a>
returns the signal value between 0-1.
</tone-explanation>
<tone-content>
<tone-oscilloscope></tone-oscilloscope>
<tone-fft></tone-fft>
<tone-play-toggle></tone-play-toggle>
</tone-content>
<tone-drawer label="Components">
<tone-player collapsed></tone-player>
</tone-drawer>
</tone-example>
<script type="text/javascript">
var player = new Tone.Player({
"url" : "./audio/FWDL.[mp3|ogg]",
"loop" : true
}).toMaster();
//connect the UI with the components
document.querySelector("tone-player").bind(player);
document.querySelector("tone-play-toggle").bind(player);
document.querySelector("tone-oscilloscope").bind(player);
document.querySelector("tone-fft").bind(player);
</script>
</body>
</html>