mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-15 16:17:58 +00:00
57 lines
No EOL
1.5 KiB
HTML
57 lines
No EOL
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Synth</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="Synth">
|
|
<a href="https://tonejs.github.io/docs/Synth" target="_blank">Tone.Synth</a> is composed simply of a
|
|
<a href="https://tonejs.github.io/docs/OmniOscillator" target="_blank">Tone.OmniOscillator</a>
|
|
routed through a
|
|
<a href="https://tonejs.github.io/docs/AmplitudeEnvelope" target="_blank">Tone.AmplitudeEnvelope</a>.
|
|
</tone-explanation>
|
|
|
|
<tone-content>
|
|
<tone-piano></tone-piano>
|
|
<tone-synth></tone-synth>
|
|
</tone-content>
|
|
</tone-example>
|
|
|
|
<script type="text/javascript">
|
|
var synth = new Tone.Synth({
|
|
"oscillator" : {
|
|
"type" : "amtriangle",
|
|
"harmonicity" : 0.5,
|
|
"modulationType" : "sine"
|
|
},
|
|
"envelope" : {
|
|
"attackCurve" : "exponential",
|
|
"attack" : 0.05,
|
|
"decay" : 0.2,
|
|
"sustain" : 0.2,
|
|
"release" : 1.5,
|
|
},
|
|
"portamento" : 0.05
|
|
}).toMaster();
|
|
|
|
//bind the interface
|
|
document.querySelector("tone-piano").bind(synth);
|
|
document.querySelector("tone-synth").bind(synth);
|
|
|
|
</script>
|
|
</body>
|
|
</html> |