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

51 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Noise</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-trigger, tone-oscilloscope {
margin-bottom: 10px;
}
tone-oscilloscope {
background-color: black;
height: 60px;
width: 100%;
}
</style>
<tone-example>
<tone-explanation label="Noise">
<a href="https://tonejs.github.io/docs/Noise">Tone.Noise</a>
has 3 different types of noise. Careful, it's loud!
</tone-explanation>
<tone-content>
<tone-oscilloscope></tone-oscilloscope>
<tone-trigger></tone-trigger>
<tone-noise></tone-noise>
</tone-content>
</tone-example>
<script type="text/javascript">
//make the noise and connect it to the output
var noise = new Tone.Noise({
"volume" : -10,
"type" : "brown"
}).toMaster();
//bind the inteface
document.querySelector("tone-oscilloscope").bind(noise);
document.querySelector("tone-trigger").bind(noise);
document.querySelector("tone-noise").bind(noise);
</script>
</body>
</html>