Tone.js/examples/polySynth.html

48 lines
1.4 KiB
HTML
Raw Normal View History

2015-06-26 05:23:05 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PolySynth</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">
2015-06-26 05:23:05 +00:00
2019-01-09 01:21:29 +00:00
<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>
2015-06-26 05:23:05 +00:00
</head>
2019-01-09 01:21:29 +00:00
<body>
<style>
tone-piano {
margin-bottom: 10px;
}
</style>
<tone-example>
<tone-explanation label="Polyphony">
<a href="https://tonejs.github.io/docs/PolySynth">Tone.PolySynth</a>
handles voice creation and allocation for any monophonic
2015-06-27 21:25:01 +00:00
instruments passed in as the second parameter. PolySynth is
2015-06-26 05:23:05 +00:00
not a synthesizer by itself, it merely manages voices of
one of the other types of synths, allowing any of the
monophonic synthesizers to be polyphonic.
2019-01-09 01:21:29 +00:00
</tone-explanation>
2015-06-26 05:23:05 +00:00
2019-01-09 01:21:29 +00:00
<tone-content>
<tone-piano polyphonic></tone-piano>
<tone-synth polyphonic></tone-synth>
</tone-content>
</tone-example>
<script type="text/javascript">
2019-09-04 16:00:15 +00:00
var synth = new Tone.PolySynth(Tone.Synth, {
"oscillator" : {
"partials" : [0, 2, 3, 4],
}
}).toMaster();
2015-06-26 05:23:05 +00:00
2019-01-09 01:21:29 +00:00
//bind the interface
document.querySelector("tone-piano").bind(synth);
document.querySelector("tone-synth").bind(synth);
2015-06-26 05:23:05 +00:00
</script>
</body>
2019-01-09 01:21:29 +00:00
</html>