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

52 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Meter</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 type="text/css">
tone-meter {
width: 100%;
background-color: black;
height: 100px;
margin-bottom: 10px;
}
</style>
<tone-example>
<tone-loader></tone-loader>
<tone-explanation label="Meter">
<a href="https://tonejs.github.io/docs/Meter" target="_blank">Tone.Meter</a>
gives you the level of the incoming signal in decibels.
</tone-explanation>
<tone-content>
<tone-meter level color="#eee"></tone-meter>
<tone-play-toggle></tone-play-toggle>
</tone-content>
<tone-drawer>
<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();
//bind the interface
document.querySelector("tone-play-toggle").bind(player);
document.querySelector("tone-meter").bind(player);
document.querySelector("tone-player").bind(player);
</script>
</body>
</html>