Tone.js/examples/duoSynth.html

131 lines
4.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
2014-09-02 20:57:46 +00:00
<html>
<head>
<meta charset="utf-8">
2015-02-24 03:14:51 +00:00
<title>MONOSYNTH</title>
2014-09-02 20:57:46 +00:00
2014-09-06 19:35:31 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
2014-09-02 20:57:46 +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-24 03:14:51 +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>
2014-09-02 20:57:46 +00:00
2015-02-24 03:14:51 +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>
2014-09-02 20:57:46 +00:00
</head>
<body>
2015-02-24 03:14:51 +00:00
<style type="text/css">
#Amplitude0, #Amplitude1 {
/*position: relative;*/
width: calc(40% - 10px)!important;
}
#FilterEnvelope0, #FilterEnvelope1 {
/*position: relative;*/
width: calc(60% - 10px)!important;
}
.FilterEnvelope.Envelope {
width: 100%!important;
}
2014-09-02 20:57:46 +00:00
2015-02-24 03:14:51 +00:00
.Envelope {
width: 100%!important;
}
.Label {
width: 100%;
font-size : 10px;
line-height: 7px;
text-align: center;
margin-top: 10px;
margin-bottom: 5px;
border-bottom: 1px solid black;
}
</style>
<div id="Explanation">
DuoSynth
<br>
<br>
A DuoSynth is two MonoSynths run in parallel with additional control over the voices harmonicity and vibrato.
</div>
<div id="Content">
<div id="KeyRack">
<div id="Keyboard"></div>
2014-09-02 20:57:46 +00:00
</div>
2015-02-24 03:14:51 +00:00
<div id="Oscillator">
</div>
<div id="Envelope">
<div id="Amplitude0"></div>
<div id="FilterEnvelope0"></div>
<div id="Amplitude1"></div>
<div id="FilterEnvelope1"></div>
2014-09-02 20:57:46 +00:00
</div>
2015-02-24 03:14:51 +00:00
<div id="Filter"></div>
<div id="Voices"></div>
<div id="Presets"></div>
2014-09-02 20:57:46 +00:00
</div>
2015-02-24 03:14:51 +00:00
<script id="ToneCode" type="text/javascript">
var synth = new Tone.DuoSynth().toMaster();
</script>
<script id="GUI" type="text/javascript">
2014-09-02 20:57:46 +00:00
2015-02-24 03:14:51 +00:00
Interface.Rack("KeyRack", "Keyboard", true).open();
//the keyboard
2014-09-02 20:57:46 +00:00
var keyboard = new QwertyHancock({
id: "Keyboard",
2015-02-24 03:14:51 +00:00
width: $("#KeyRack").width(),
2014-09-02 20:57:46 +00:00
height: 75,
2015-02-24 03:14:51 +00:00
octaves : 3,
startNote: "A2",
2014-09-02 20:57:46 +00:00
});
keyboard.keyDown = function(note, freq){
synth.triggerAttack(freq);
};
keyboard.keyUp = function(){
synth.triggerRelease();
};
2015-02-24 03:14:51 +00:00
//the oscillator
Interface.Rack("Oscillator", "Oscillators", true);
$("<div>").addClass("Label").appendTo("#Oscillator").text("Voice 0");
Interface.DropDown("Oscillator", synth.voice0.oscillator, "type", ["sine", "square", "triangle", "sawtooth", "pwm", "pulse"]).listen();
$("<div>").addClass("Label").appendTo("#Oscillator").text("Voice 1");
Interface.DropDown("Oscillator", synth.voice1.oscillator, "type", ["sine", "square", "triangle", "sawtooth", "pwm", "pulse"]).listen();
//the envelopes
Interface.Rack("Envelope", "Envelopes", true);
var ampGroup0 = Interface.Group("Amplitude0", "Voice 0 Amplitude");
Interface.AmplitudeEnvelope(ampGroup0, synth.voice0.envelope).listen();
var filtGroup0 = Interface.Group("FilterEnvelope0", "Voice 0 Filter");
Interface.FilterEnvelope(filtGroup0, synth.voice0.filterEnvelope).listen();
var ampGroup1 = Interface.Group("Amplitude1", "Voice 1 Amplitude");
Interface.AmplitudeEnvelope(ampGroup1, synth.voice1.envelope).listen();
var filtGroup1 = Interface.Group("FilterEnvelope1", "Voice 1 Filter");
Interface.FilterEnvelope(filtGroup1, synth.voice1.filterEnvelope).listen();
//the filters
Interface.Rack("Filter", "Filter", true);
$("<div>").addClass("Label").appendTo("#Filter").text("Voice 0");
var type = Interface.DropDown("Filter", synth.voice0.filter, "type", ["lowpass", "highpass", "bandpass"]).listen();
var Q = Interface.Slider("Filter", synth.voice0.filter, "Q", 0.1, 20).listen();
$("<div>").addClass("Label").appendTo("#Filter").text("Voice 0");
var type = Interface.DropDown("Filter", synth.voice1.filter, "type", ["lowpass", "highpass", "bandpass"]).listen();
var Q = Interface.Slider("Filter", synth.voice1.filter, "Q", 0.1, 20).listen();
//other settings
Interface.Rack("Voices", "Voices", true);
Interface.Slider("Voices", synth, "harmonicity", 0.25, 5).listen();
$("<div>").addClass("Label").appendTo("#Voices").text("Vibrato");
Interface.Slider("Voices", synth, "vibratoRate", 0.25, 10).listen();
Interface.Slider("Voices", synth, "vibratoAmount", 0, 1).listen();
//presets
Interface.Rack("Presets", "Presets", true);
Interface.Presets("Presets", synth);
2014-09-02 20:57:46 +00:00
</script>
</body>
</html>