2014-10-22 22:49:42 +00:00
|
|
|
<!DOCTYPE html>
|
2014-06-23 17:29:22 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-10-22 22:49:42 +00:00
|
|
|
<meta charset="utf-8">
|
2014-06-23 17:29:22 +00:00
|
|
|
<title>Oscillator</title>
|
2014-08-28 04:39:17 +00:00
|
|
|
|
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">
|
2014-06-23 17:29:22 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/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"/>
|
2019-01-09 01:21:29 +00:00
|
|
|
<script src="../build/Tone.js"></script>
|
2020-07-18 00:36:42 +00:00
|
|
|
<script src="../../examples/dist/tone-gui.js"></script>
|
|
|
|
<script src="../../examples/dist/components.js"></script>
|
2019-01-09 01:21:29 +00:00
|
|
|
<style type="text/css">
|
|
|
|
tone-play-toggle {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
</style>
|
2014-06-23 17:29:22 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2020-07-18 00:36:42 +00:00
|
|
|
<tone-example label="Oscillator">
|
|
|
|
<div slot="explanation">
|
2019-01-09 01:21:29 +00:00
|
|
|
The oscillator has 4 basic types which can be altered by setting the number
|
|
|
|
of partials and partials array.
|
2015-06-27 22:02:55 +00:00
|
|
|
<br><br>
|
2019-01-09 01:21:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/Oscillator">Tone.Oscillator</a> docs.
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
<div id="content">
|
|
|
|
<tone-momentary-button></tone-momentary-button>
|
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-example>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2015-06-08 14:41:45 +00:00
|
|
|
var osc = new Tone.Oscillator({
|
2019-01-09 01:21:29 +00:00
|
|
|
"type" : "square",
|
2015-06-08 14:41:45 +00:00
|
|
|
"frequency" : 440,
|
2019-01-09 01:21:29 +00:00
|
|
|
"volume" : -16
|
2020-07-18 00:36:42 +00:00
|
|
|
}).toDestination();
|
|
|
|
|
|
|
|
ui({
|
|
|
|
tone: osc,
|
|
|
|
parent: document.querySelector('#content')
|
|
|
|
})
|
2015-06-08 14:41:45 +00:00
|
|
|
|
2019-01-09 01:21:29 +00:00
|
|
|
//bind the interface
|
2020-07-18 00:36:42 +00:00
|
|
|
document.querySelector('tone-momentary-button').addEventListener('down', () => osc.start())
|
|
|
|
document.querySelector('tone-momentary-button').addEventListener('up', () => osc.stop())
|
2014-06-23 17:29:22 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|