Tone.js/examples/fmSynth.html

75 lines
1.7 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
2015-06-27 22:10:18 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
2015-12-08 05:06:58 +00:00
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
2015-06-27 21:25:01 +00:00
<script src="../build/Tone.js"></script>
<script src="./scripts/jquery.min.js"></script>
<script src="./scripts/draggabilly.js"></script>
<script src="./scripts/StartAudioContext.js"></script>
<script src="./scripts/Interface.js"></script>
<script src="https://tonejs.github.io/Logo/build/Logo.js"></script>
<script src="./scripts/Keyboard.js"></script>
2014-09-03 18:54:46 +00:00
2015-02-24 03:14:51 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script>
2015-02-24 03:14:51 +00:00
// jshint ignore: start
</script>
2014-09-03 18:54:46 +00:00
</head>
<body>
2015-02-24 03:14:51 +00:00
<div id="Content">
2015-06-27 21:25:01 +00:00
<div id="Title">FMSynth</div>
<div id="Explanation">
<a href="https://tonejs.github.io/docs/#FMSynth">Tone.FMSynth</a>
2015-06-27 22:02:55 +00:00
is composed of two
<a href="https://tonejs.github.io/docs/#Synth">Tone.Synths</a>
where one Tone.Synth modulates the frequency of a second Tone.Synth.
2014-09-03 18:54:46 +00:00
</div>
</div>
<script>
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
2017-03-26 20:39:19 +00:00
// GUI //
2015-06-27 21:25:01 +00:00
2017-03-26 20:39:19 +00:00
Interface.Slider({
tone : synth,
param : "modulationIndex",
name : "mod index",
max : 100
});
2014-09-03 18:54:46 +00:00
2017-03-26 20:39:19 +00:00
var keyboard = Interface.Keyboard();
2015-06-27 21:25:01 +00:00
2017-03-26 20:39:19 +00:00
keyboard.keyDown = function (note) {
synth.triggerAttack(note);
};
keyboard.keyUp = function (note) {
synth.triggerRelease();
};
2015-06-27 21:25:01 +00:00
2014-09-03 18:54:46 +00:00
</script>
</body>
</html>