mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
73 lines
1.7 KiB
HTML
73 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>MonoSynth</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 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>
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/examples.css">
|
|
|
|
<script>
|
|
// jshint ignore: start
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="Content">
|
|
<div id="Title">MonoSynth</div>
|
|
<div id="Explanation">
|
|
<a href="https://tonejs.github.io/docs/#MonoSynth">Tone.MonoSynth</a>
|
|
is composed of one oscillator, one filter, and two envelopes.
|
|
Both envelopes are triggered simultaneously when a note is triggered.
|
|
</div>
|
|
<div id="Keyboard"></div>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
var synth = new Tone.MonoSynth({
|
|
"oscillator" : {
|
|
"type" : "square8"
|
|
},
|
|
"envelope" : {
|
|
"attack" : 0.05,
|
|
"decay" : 0.3,
|
|
"sustain" : 0.4,
|
|
"release" : 0.8,
|
|
},
|
|
"filterEnvelope" : {
|
|
"attack" : 0.001,
|
|
"decay" : 0.7,
|
|
"sustain" : 0.1,
|
|
"release" : 0.8,
|
|
"baseFrequency" : 300,
|
|
"octaves" : 4
|
|
}
|
|
}).toMaster();
|
|
|
|
// GUI //
|
|
|
|
var keyboard = Interface.Keyboard();
|
|
|
|
keyboard.keyDown = function (note) {
|
|
synth.triggerAttack(note);
|
|
};
|
|
|
|
keyboard.keyUp = function () {
|
|
synth.triggerRelease();
|
|
};
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|