Tone.js/examples/monoSynth.html
2015-07-04 14:43:17 -04:00

89 lines
No EOL
2.1 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">
<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/Notone.GUI.js"></script>
<script type="text/javascript" src="./scripts/Interface.js"></script>
<script type="text/javascript" src="./scripts/qwerty-hancock.js"></script>
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<script type="text/javascript">
// jshint ignore: start
</script>
</head>
<body>
<style type="text/css">
</style>
<div id="Content">
<div id="Title">MonoSynth</div>
<div id="Explanation">
<a href="http://tonejs.org/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.
<img src="https://docs.google.com/drawings/d/1gaY1DF9_Hzkodqf8JI1Cg2VZfwSElpFQfI94IQwad38/pub?w=924&h=240">
</div>
<div id="Keyboard"></div>
</div>
<script type="text/javascript">
var synth = new Tone.MonoSynth({
"oscillator" : {
"type" : "square"
},
"envelope" : {
"attack" : 0.01,
"decay" : 0.2,
"sustain" : 0.4,
"release" : 0.2,
}
}).toMaster();
</script>
<script id="GUI" type="text/javascript">
$(function(){
Notone.config({
"search" : false,
"expandInDrawer" : true,
"hideDrawer" : Interface.isMobile,
"drawer" : true,
"container" : "body"
});
Notone.add(synth);
var keyboard = new QwertyHancock({
id: "Keyboard",
width: $("#Content").width(),
height: 150,
octaves: Interface.isMobile ? 1.26 : 3,
startNote: "C3",
whiteKeyColour: "white",
blackKeyColour: "#1EDF3E",
activeColour : "#3833ED"
});
keyboard.keyDown = function (note, frequency) {
synth.triggerAttack(frequency);
};
keyboard.keyUp = function () {
synth.triggerRelease();
};
});
</script>
</style>
</body>
</html>