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

47 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oscillator</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>
<style type="text/css">
tone-play-toggle {
margin-bottom: 10px;
}
</style>
</head>
<body>
<tone-example>
<tone-explanation label="Oscillator">
The oscillator has 4 basic types which can be altered by setting the number
of partials and partials array.
<br><br>
<a href="https://tonejs.github.io/docs/Oscillator">Tone.Oscillator</a> docs.
</tone-explanation>
<tone-content>
<tone-play-toggle></tone-play-toggle>
<tone-oscillator label="Oscillator" frequency></tone-oscillator>
</tone-content>
</tone-example>
<script type="text/javascript">
var osc = new Tone.Oscillator({
"type" : "square",
"frequency" : 440,
"volume" : -16
}).toMaster();
//bind the interface
document.querySelector("tone-oscillator").bind(osc);
document.querySelector("tone-play-toggle").bind(osc);
</script>
</body>
</html>