2015-06-26 05:23:05 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2016-05-23 23:52:56 +00:00
|
|
|
<title>Synth</title>
|
2015-06-26 05:23:05 +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-26 05:23:05 +00:00
|
|
|
|
2017-03-18 16:35:37 +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>
|
2015-06-26 05:23:05 +00:00
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="./style/examples.css">
|
|
|
|
|
2017-03-18 16:35:37 +00:00
|
|
|
<script>
|
2015-06-26 05:23:05 +00:00
|
|
|
// jshint ignore: start
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
img {
|
|
|
|
width: 80%;
|
|
|
|
max-width: 700px;
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
#Keyboard {
|
|
|
|
margin: 3px!important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="Content">
|
2016-05-23 23:52:56 +00:00
|
|
|
<div id="Title">Synth</div>
|
2015-06-26 05:23:05 +00:00
|
|
|
<div id="Explanation">
|
2016-07-07 20:10:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/#Synth" target="_blank">Tone.Synth</a> is composed simply of a
|
|
|
|
<a href="https://tonejs.github.io/docs/#OmniOscillator" target="_blank">Tone.OmniOscillator</a>
|
2015-06-26 05:23:05 +00:00
|
|
|
routed through a
|
2016-07-07 20:10:29 +00:00
|
|
|
<a href="https://tonejs.github.io/docs/#AmplitudeEnvelope" target="_blank">Tone.AmplitudeEnvelope</a>.
|
2015-06-26 05:23:05 +00:00
|
|
|
</div>
|
|
|
|
<div id="Keyboard"></div>
|
|
|
|
</div>
|
|
|
|
|
2017-03-18 16:35:37 +00:00
|
|
|
<script>
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2016-05-23 23:52:56 +00:00
|
|
|
var synth = new Tone.Synth({
|
2015-06-26 05:23:05 +00:00
|
|
|
"oscillator" : {
|
|
|
|
"type" : "square"
|
|
|
|
},
|
|
|
|
"envelope" : {
|
|
|
|
"attack" : 0.01,
|
|
|
|
"decay" : 0.2,
|
2015-12-05 18:20:53 +00:00
|
|
|
"sustain" : 0.2,
|
2015-06-26 05:23:05 +00:00
|
|
|
"release" : 0.2,
|
|
|
|
}
|
|
|
|
}).toMaster();
|
|
|
|
|
2017-03-26 20:39:19 +00:00
|
|
|
// GUI //
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2017-03-26 20:39:19 +00:00
|
|
|
var keyboard = Interface.Keyboard();
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2017-03-26 20:39:19 +00:00
|
|
|
keyboard.keyDown = function (note) {
|
|
|
|
synth.triggerAttack(note);
|
|
|
|
};
|
2015-06-26 05:23:05 +00:00
|
|
|
|
2017-03-26 20:39:19 +00:00
|
|
|
keyboard.keyUp = function () {
|
|
|
|
synth.triggerRelease();
|
|
|
|
};
|
2015-06-26 05:23:05 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
2017-03-18 16:35:37 +00:00
|
|
|
</html>
|