2014-10-22 22:49:42 +00:00
|
|
|
<!DOCTYPE html>
|
2014-09-03 18:54:46 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-10-22 22:49:42 +00:00
|
|
|
<meta charset="utf-8">
|
2016-01-30 21:18:28 +00:00
|
|
|
<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
|
|
|
|
2020-07-18 00:58:09 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.4.3/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:58:09 +00:00
|
|
|
<script src="./js/tone-ui.js"></script>
|
|
|
|
<script src="./js/components.js"></script>
|
2014-09-03 18:54:46 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2020-07-18 00:36:42 +00:00
|
|
|
<tone-example label="FMSynth">
|
|
|
|
<div slot="explanation">
|
2019-01-09 01:21:29 +00:00
|
|
|
<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>
|
2016-05-23 23:52:56 +00:00
|
|
|
where one Tone.Synth modulates the frequency of a second Tone.Synth.
|
2020-07-18 00:36:42 +00:00
|
|
|
</div>
|
2014-09-03 18:54:46 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
<div id="content">
|
|
|
|
</div>
|
2019-01-09 01:21:29 +00:00
|
|
|
</tone-example>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2020-07-18 00:36:42 +00:00
|
|
|
const synth = new Tone.FMSynth({
|
|
|
|
modulationIndex: 12.22,
|
|
|
|
envelope: {
|
|
|
|
attack: 0.01,
|
|
|
|
decay: 0.2
|
2015-12-05 18:20:53 +00:00
|
|
|
},
|
2020-07-18 00:36:42 +00:00
|
|
|
modulation: {
|
|
|
|
type: "square"
|
2016-01-30 21:18:28 +00:00
|
|
|
},
|
2020-07-18 00:36:42 +00:00
|
|
|
modulationEnvelope: {
|
|
|
|
attack: 0.2,
|
|
|
|
decay: 0.01
|
2015-12-05 18:20:53 +00:00
|
|
|
}
|
2020-07-18 00:36:42 +00:00
|
|
|
}).toDestination();
|
2014-09-03 18:54:46 +00:00
|
|
|
|
2020-07-18 00:36:42 +00:00
|
|
|
piano({
|
|
|
|
tone: synth,
|
|
|
|
parent: document.querySelector("#content"),
|
|
|
|
noteon: (note) => synth.triggerAttack(note.name),
|
|
|
|
noteoff: (note) => synth.triggerRelease()
|
|
|
|
})
|
|
|
|
|
|
|
|
ui({
|
|
|
|
tone: synth,
|
|
|
|
name: "FMSynth",
|
|
|
|
parent: document.querySelector("#content"),
|
|
|
|
})
|
2014-09-03 18:54:46 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|