mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
48 lines
No EOL
1.4 KiB
HTML
48 lines
No EOL
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>PolySynth</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-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
|
|
instruments passed in as the second parameter. PolySynth is
|
|
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.
|
|
</tone-explanation>
|
|
|
|
<tone-content>
|
|
<tone-piano polyphonic></tone-piano>
|
|
<tone-synth polyphonic></tone-synth>
|
|
</tone-content>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
var synth = new Tone.PolySynth(8, Tone.Synth, {
|
|
"oscillator" : {
|
|
"partials" : [0, 2, 3, 4],
|
|
}
|
|
}).toMaster();
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-piano").bind(synth);
|
|
document.querySelector("tone-synth").bind(synth);
|
|
</script>
|
|
</body>
|
|
</html> |