2016-05-18 01:27:46 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Meter</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">
|
2017-08-31 16:41:36 +00:00
|
|
|
|
2020-07-18 00:58:09 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
|
2020-07-18 00:36:42 +00:00
|
|
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>
|
2017-03-18 16:35:37 +00:00
|
|
|
<script src="../build/Tone.js"></script>
|
2020-07-18 00:58:09 +00:00
|
|
|
<script src="./js/tone-ui.js"></script>
|
|
|
|
<script src="./js/components.js"></script>
|
2016-05-18 01:27:46 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2020-07-18 00:36:42 +00:00
|
|
|
<tone-example label="Meter">
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-loader></tone-loader>
|
2020-07-18 00:36:42 +00:00
|
|
|
<div slot="explanation">
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/Meter" target="_blank">Tone.Meter</a>
|
2017-08-31 16:41:36 +00:00
|
|
|
gives you the level of the incoming signal in decibels.
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2017-08-31 16:41:36 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
<div id="content">
|
2019-01-09 01:21:29 +00:00
|
|
|
<tone-play-toggle></tone-play-toggle>
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-example>
|
2016-05-18 01:27:46 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<script type="text/javascript">
|
2020-07-18 00:36:42 +00:00
|
|
|
const player = new Tone.Player({
|
|
|
|
url: "https://tonejs.github.io/audio/berklee/Resonant_FM_laser1.mp3",
|
|
|
|
loop: true
|
|
|
|
}).toDestination();
|
|
|
|
|
|
|
|
const toneMeter = new Tone.Meter({
|
|
|
|
channels: 2,
|
|
|
|
});
|
|
|
|
player.connect(toneMeter);
|
|
|
|
|
|
|
|
meter({
|
|
|
|
tone: toneMeter,
|
|
|
|
parent: document.querySelector("#content")
|
|
|
|
});
|
|
|
|
|
|
|
|
ui({
|
|
|
|
tone: player,
|
|
|
|
name: "Player",
|
|
|
|
parent: document.querySelector("#content")
|
|
|
|
});
|
|
|
|
|
|
|
|
// bind the interface
|
|
|
|
document.querySelector("tone-play-toggle").addEventListener("start", () => player.start());
|
|
|
|
document.querySelector("tone-play-toggle").addEventListener("stop", () => player.stop());
|
|
|
|
|
2016-05-18 01:27:46 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|