Tone.js/examples/fmSynth.html

56 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-09-03 18:54:46 +00:00
<html>
<head>
<meta charset="utf-8">
<title>FMSynth</title>
2014-09-03 18:54:46 +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">
2015-02-24 03:14:51 +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>
2014-09-03 18:54:46 +00:00
</head>
<body>
2019-01-09 01:21:29 +00:00
<style>
tone-piano {
margin-bottom: 10px;
}
</style>
<tone-example>
<tone-explanation label="FMSynth">
<a href="https://tonejs.github.io/docs/FMSynth">Tone.FMSynth</a>
2015-06-27 22:02:55 +00:00
is composed of two
2019-01-09 01:21:29 +00:00
<a href="https://tonejs.github.io/docs/Synth">Tone.Synths</a>
where one Tone.Synth modulates the frequency of a second Tone.Synth.
2019-01-09 01:21:29 +00:00
</tone-explanation>
2014-09-03 18:54:46 +00:00
2019-01-09 01:21:29 +00:00
<tone-content>
<tone-piano></tone-piano>
<tone-fm-synth></tone-fm-synth>
</tone-content>
</tone-example>
<script type="text/javascript">
var synth = new Tone.FMSynth({
"modulationIndex" : 12.22,
"envelope" : {
"attack" : 0.01,
"decay" : 0.2
},
"modulation" : {
"type" : "square"
},
"modulationEnvelope" : {
"attack" : 0.2,
"decay" : 0.01
}
2015-06-27 21:25:01 +00:00
}).toMaster();
2014-09-03 18:54:46 +00:00
2019-01-09 01:21:29 +00:00
//bind the interface
document.querySelector("tone-piano").bind(synth);
document.querySelector("tone-fm-synth").bind(synth);
2014-09-03 18:54:46 +00:00
</script>
</body>
</html>