diff --git a/Tone/instrument/MonoSynth.js b/Tone/instrument/MonoSynth.js index 10035684..62bd5226 100644 --- a/Tone/instrument/MonoSynth.js +++ b/Tone/instrument/MonoSynth.js @@ -1,4 +1,4 @@ -define(["Tone/core/Tone", "Tone/component/Envelope", "Tone/source/Oscillator", +define(["Tone/core/Tone", "Tone/component/Envelope", "Tone/source/OmniOscillator", "Tone/signal/Signal", "Tone/component/Filter", "Tone/signal/Add", "Tone/instrument/Monophonic"], function(Tone){ @@ -21,9 +21,9 @@ function(Tone){ /** * the first oscillator - * @type {Tone.Oscillator} + * @type {Tone.OmniOscillator} */ - this.oscillator = new Tone.Oscillator(0, options.oscType); + this.oscillator = new Tone.OmniOscillator(options.oscillator); /** * the frequency control signal @@ -81,7 +81,9 @@ function(Tone){ * @type {Object} */ Tone.MonoSynth.defaults = { - "oscType" : "square", + "oscillator" : { + "type" : "square" + }, "filter" : { "Q" : 6, "type" : "lowpass", @@ -139,7 +141,7 @@ function(Tone){ */ Tone.MonoSynth.prototype.set = function(params){ if (!this.isUndef(params.detune)) this.detune.setValue(params.detune); - if (!this.isUndef(params.oscType)) this.setOscType(params.oscType); + if (!this.isUndef(params.oscillator)) this.oscillator.set(params.oscillator); if (!this.isUndef(params.filterEnvelope)) this.filterEnvelope.set(params.filterEnvelope); if (!this.isUndef(params.envelope)) this.envelope.set(params.envelope); if (!this.isUndef(params.filter)) this.filter.set(params.filter); diff --git a/Tone/instrument/preset/MonoSynth.preset.js b/Tone/instrument/preset/MonoSynth.preset.js index af9a9040..b8182172 100644 --- a/Tone/instrument/preset/MonoSynth.preset.js +++ b/Tone/instrument/preset/MonoSynth.preset.js @@ -7,9 +7,37 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ * @type {Object} */ Tone.MonoSynth.prototype.preset = { + "CoolGuy" : { + "portamento" : 0.0, + "oscillator" : { + "type" : "pwm", + "modulationFrequency" : 1 + }, + "filter" : { + "Q" : 6, + "type" : "lowpass", + "rolloff" : -24 + }, + "envelope" : { + "attack" : 0.025, + "decay" : 0.3, + "sustain" : 0.9, + "release" : 2 + }, + "filterEnvelope" : { + "attack" : 0.245, + "decay" : 0.131, + "sustain" : 0.5, + "release" : 2, + "min" : 20, + "max" : 3000 + } + }, "Pianoetta" : { "portamento" : 0.0, - "oscType" : "square", + "oscillator" : { + "type" : "square" + }, "filter" : { "Q" : 6, "type" : "lowpass", @@ -32,7 +60,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "Barky" : { "portamento" : 0.01, - "oscType" : "triangle", + "oscillator" : { + "type" : "triangle" + }, "filter" : { "Q" : 3, "type" : "highpass", @@ -55,7 +85,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "Bassy" : { "portamento" : 0.08, - "oscType" : "square", + "oscillator" : { + "type" : "square" + }, "filter" : { "Q" : 4, "type" : "lowpass", @@ -78,7 +110,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "BrassCircuit" : { "portamento" : 0.01, - "oscType" : "sawtooth", + "oscillator" : { + "type" : "sawtooth" + }, "filter" : { "Q" : 2, "type" : "lowpass", @@ -101,7 +135,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "Pizz" : { "portamento" : 0.00, - "oscType" : "square", + "oscillator" : { + "type" : "square" + }, "filter" : { "Q" : 2, "type" : "highpass", @@ -124,7 +160,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "Kick" : { "portamento" : 0.00, - "oscType" : "square", + "oscillator" : { + "type" : "square" + }, "filter" : { "Q" : 2, "type" : "bandpass", @@ -147,7 +185,9 @@ define(["Tone/core/Tone", "Tone/instrument/MonoSynth"], function(Tone){ }, "LaserSteps" : { "portamento" : 0.00, - "oscType" : "sawtooth", + "oscillator" : { + "type" : "sawtooth" + }, "filter" : { "Q" : 2, "type" : "bandpass", diff --git a/examples/Widgets.js b/examples/Widgets.js index 02da86df..50ae10b2 100644 --- a/examples/Widgets.js +++ b/examples/Widgets.js @@ -414,6 +414,26 @@ GUI.Oscillator.prototype.render = function(){ this.type.select(type); }; +/** + * OMNIOSCILLATOR + */ +GUI.OmniOscillator = function(container, oscillator, label){ + this.element = $("