Tone.js/examples/monoSynth.html

82 lines
2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
2015-06-26 05:23:05 +00:00
<title>MonoSynth</title>
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
<script type="text/javascript" src="../build/Tone.js"></script>
2015-06-26 05:23:05 +00:00
<script type="text/javascript" src="./scripts/jquery.min.js"></script>
<script type="text/javascript" src="./scripts/draggabilly.js"></script>
2016-03-04 22:38:32 +00:00
<script type="text/javascript" src="./scripts/StartAudioContext.js"></script>
2015-02-20 05:59:19 +00:00
<script type="text/javascript" src="./scripts/Interface.js"></script>
2016-07-07 21:31:06 +00:00
<script type="text/javascript" src="https://tonejs.github.io/Logo/build/Logo.js"></script>
<script type="text/javascript" src="./scripts/Keyboard.js"></script>
2015-02-20 05:59:19 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script type="text/javascript">
// jshint ignore: start
</script>
</head>
2015-06-26 05:23:05 +00:00
<body>
2015-02-20 05:59:19 +00:00
<style type="text/css">
2015-06-26 05:23:05 +00:00
2015-02-20 05:59:19 +00:00
</style>
<div id="Content">
2015-06-26 05:23:05 +00:00
<div id="Title">MonoSynth</div>
<div id="Explanation">
<a href="https://tonejs.github.io/docs/#MonoSynth">Tone.MonoSynth</a>
2015-06-27 22:02:55 +00:00
is composed of one oscillator, one filter, and two envelopes.
2015-06-26 05:23:05 +00:00
Both envelopes are triggered simultaneously when a note is triggered.
2014-09-02 04:25:38 +00:00
</div>
2015-06-26 05:23:05 +00:00
<div id="Keyboard"></div>
</div>
2015-06-26 05:23:05 +00:00
<script type="text/javascript">
var synth = new Tone.MonoSynth({
2015-12-06 00:10:27 +00:00
"portamento" : 0.01,
2015-06-26 05:23:05 +00:00
"oscillator" : {
"type" : "square"
},
"envelope" : {
2015-12-06 00:10:27 +00:00
"attack" : 0.005,
2015-06-26 05:23:05 +00:00
"decay" : 0.2,
"sustain" : 0.4,
2015-12-06 00:10:27 +00:00
"release" : 1.4,
},
"filterEnvelope" : {
"attack" : 0.005,
"decay" : 0.1,
"sustain" : 0.05,
"release" : 0.8,
"baseFrequency" : 300,
"octaves" : 4
2015-06-26 05:23:05 +00:00
}
}).toMaster();
2015-02-20 05:59:19 +00:00
</script>
2015-06-26 05:23:05 +00:00
2015-02-20 05:59:19 +00:00
<script id="GUI" type="text/javascript">
2015-06-26 05:23:05 +00:00
$(function(){
var keyboard = Interface.Keyboard();
2015-06-26 05:23:05 +00:00
keyboard.keyDown = function (note) {
synth.triggerAttack(note);
2015-06-26 05:23:05 +00:00
};
keyboard.keyUp = function () {
synth.triggerRelease();
};
2014-09-02 04:25:38 +00:00
});
</script>
2015-06-26 05:23:05 +00:00
</style>
</body>
</html>