mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
a2343bd31a
[skip ci]
77 lines
No EOL
1.9 KiB
HTML
77 lines
No EOL
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>FMSynth</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="icon" type="image/png" sizes="174x174" href="./style/favicon.png">
|
|
|
|
<script type="text/javascript" src="../build/Tone.js"></script>
|
|
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
|
|
<script type="text/javascript" src="./scripts/draggabilly.js"></script>
|
|
<script type="text/javascript" src="./scripts/StartAudioContext.js"></script>
|
|
<script type="text/javascript" src="./scripts/Interface.js"></script>
|
|
<script type="text/javascript" src="https://tonejs.github.io/Logo/build/Logo.js"></script>
|
|
<script type="text/javascript" src="./scripts/Keyboard.js"></script>
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/examples.css">
|
|
|
|
<script type="text/javascript">
|
|
// jshint ignore: start
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="Content">
|
|
<div id="Title">FMSynth</div>
|
|
<div id="Explanation">
|
|
<a href="https://tonejs.github.io/docs/#FMSynth">Tone.FMSynth</a>
|
|
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.
|
|
</div>
|
|
</div>
|
|
|
|
<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
|
|
}
|
|
}).toMaster();
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function(){
|
|
|
|
Interface.Slider({
|
|
tone : synth,
|
|
param : "modulationIndex",
|
|
name : "mod index",
|
|
max : 100
|
|
});
|
|
|
|
var keyboard = Interface.Keyboard();
|
|
|
|
keyboard.keyDown = function (note) {
|
|
synth.triggerAttack(note);
|
|
};
|
|
|
|
keyboard.keyUp = function (note) {
|
|
synth.triggerRelease();
|
|
};
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |