Tone.js/examples/monoSynth.html

87 lines
2.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
2014-06-25 16:47:47 +00:00
<title>MONOSYNTH</title>
2014-09-06 19:35:31 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
2014-09-02 04:25:38 +00:00
<script type="text/javascript" src="./deps/jquery.min.js"></script>
<script type="text/javascript" src="../build/Tone.js"></script>
2014-09-05 03:56:34 +00:00
<script type="text/javascript" src="../build/Tone.Preset.js"></script>
2015-02-20 05:59:19 +00:00
<script type="text/javascript" src="./deps/nexusUI.js"></script>
<script type="text/javascript" src="./deps/prism.js"></script>
<script type="text/javascript" src="./scripts/Interface.js"></script>
<script type="text/javascript" src="./deps/qwerty-hancock.js"></script>
2015-02-20 05:59:19 +00:00
<link rel="stylesheet" type="text/css" href="./style/examples.css">
<link rel="stylesheet" type="text/css" href="./style/prism.css">
<script type="text/javascript">
// jshint ignore: start
</script>
</head>
<body>
2015-02-20 05:59:19 +00:00
<style type="text/css">
#Amplitude {
position: relative;
}
</style>
<div id="Explanation">
MonoSynth
<br>
<br>
MonoSynth is a monophonic synthesizer composed simply of one oscillator and one filter each with their own independent envelope.
</div>
<div id="Content">
<div id="KeyRack">
<div id="Keyboard"></div>
2014-09-02 04:25:38 +00:00
</div>
2015-02-20 05:59:19 +00:00
<div id="Oscillator"></div>
<div id="Envelope">
<div id="Amplitude"></div>
<div id="FilterEnvelope"></div>
2014-09-02 04:25:38 +00:00
</div>
2015-02-20 05:59:19 +00:00
<div id="FilterEnv"></div>
</div>
2015-02-20 05:59:19 +00:00
<script id="ToneCode" type="text/javascript">
var synth = new Tone.MonoSynth().toMaster();
</script>
<script id="GUI" type="text/javascript">
2014-09-02 04:25:38 +00:00
2015-02-20 05:59:19 +00:00
Interface.Rack("KeyRack", "Keyboard", true).open();
//the keyboard
2014-09-02 04:25:38 +00:00
var keyboard = new QwertyHancock({
id: "Keyboard",
2015-02-20 05:59:19 +00:00
width: $("#KeyRack").width(),
2014-09-02 04:25:38 +00:00
height: 75,
2015-02-20 05:59:19 +00:00
octaves : 3,
startNote: "A2",
2014-09-02 04:25:38 +00:00
});
keyboard.keyDown = function(note, freq){
synth.triggerAttack(freq);
};
2014-09-02 16:15:20 +00:00
keyboard.keyUp = function(){
2014-09-02 04:25:38 +00:00
synth.triggerRelease();
};
2015-02-20 05:59:19 +00:00
//the oscillator
Interface.Rack("Oscillator", "Oscillator", true);
Interface.DropDown("Oscillator", synth.oscillator, "type", ["sine", "square", "triangle", "sawtooth", "pwm", "pulse"]);
//the envelopes
Interface.Rack("Envelope", "Envelopes", true);
var ampGroup = Interface.Group("Amplitude", "Amplitude");
Interface.AmplitudeEnvelope(ampGroup, synth.envelope);
var filtGroup = Interface.Group("FilterEnvelope", "Filter");
Interface.FilterEnvelope(filtGroup, synth.filterEnvelope);
// var filtGroup = Interface.Group("Envelope", "Filter");
// Interface.Rack("FilterEnv", "Filter Envelope", true);
// var Q = Interface.Slider("FilterEnv", synth.filter, "Q", 0.1, 20);
// var type = Interface.DropDown("FilterEnv", synth.filter, "type", ["lowpass", "highpass", "bandpass", "notch"]);
2014-09-02 04:25:38 +00:00
</script>
</body>
</html>