Tone.js/examples/meter.html
Yotam Mann a256ae2e6c
Working on getting github actions to run (#1231)
* working on getting actions to run

* running all tests

* run on CHROME only

* Update test.yml

* ignoring node_modules

* updating typedocs

* trying to ignore compiler errors

* Update tsconfig.json

* running doc tests in parallel

* speeding up docs example tests

* Update test.yml

* testing README

* 2 spaces instead of 4

* codecov

* remove travis ci

* adding token

* updating codecov
2024-04-25 14:06:55 -04:00

57 lines
1.6 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://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/webcomponents-bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet"/>
<script src="../build/Tone.js"></script>
<script src="./js/tone-ui.js"></script>
<script src="./js/components.js"></script>
</head>
<body>
<tone-example label="Meter">
<tone-loader></tone-loader>
<div slot="explanation">
<a href="https://tonejs.github.io/docs/Meter" target="_blank">Tone.Meter</a>
gives you the level of the incoming signal in decibels.
</div>
<div id="content">
<tone-play-toggle></tone-play-toggle>
</div>
</tone-example>
<script type="text/javascript">
const player = new Tone.Player({
url: "https://tonejs.github.io/audio/berklee/Resonant_FM_laser1.mp3",
loop: true
}).toDestination();
const toneMeter = new Tone.Meter({
channelCount: 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());
</script>
</body>
</html>