{
   "ancestor_list" : [],
   "description" : "This is just a different keyboard layout for the code I found called \"Operator\". Thank you Alexander Lunt, wherever you might be!\r\nI changed the weird/possibly wrong kind of keyboard layout first into something that resembled piano layout, then I changed it to an old favorite.\r\nThe Isomorphic layout can easily utilize the offset nature of the different rows of keys on a computer keyboard to play the same chord shapes for each chord type... as seen here: https://muted.io/isomorphic-keyboard/\r\nOne other change I made, was to move some of the code nearer the beginning/top, because \"select all\" was stumbling on or missing that portion of code.\r\n\r\nLet me know if something doesn't work, or fix it yourself and repost!",
   "name" : "Operator-synth_Isomorphic-version",
   "author" : "Marty Carlton",
   "is_private" : null,
   "id" : "1-5fM",
   "code" : "//Code by Alexander Lunt\r\n// adjusted/changed by Marty Carlton\r\n(\r\n///////////////////////////////////////////////////////GUI\r\nServer.default.waitForBoot({\r\n\r\n\tvar fx;\r\n\tvar fxSynth = {\r\n\t\tSynthDef.new(\\masterFX, {\r\n\t\t\targ input, pos = 0, delayTime = 0, decayTime = 0, level = 1;\r\n\t\t\tvar in, snd, fb, delay, left, right, locIn;\r\n\r\n\t\t\tin = In.ar(input,1);\r\n\t\t\tlocIn = LocalIn.ar(1, 0);\r\n\t\t\tsnd = locIn + in;\r\n\t\t\tfb = DelayC.ar(snd*decayTime, 1, delayTime);\r\n\t\t\tLocalOut.ar( fb );\r\n\t\t\tsnd = Balance2.ar(snd, snd, pos, level);\r\n\t\t\tOut.ar(0, snd);\r\n\r\n\t\t}).add;\r\n\r\n\t\tfx = Synth.new(\\masterFX, [\\input, ~out]);\r\n\t};\r\n\r\n\tvar stringColor = Color.new255(250,250,210);\r\n\tvar play = Button().states_([[\"play\"]]).mouseOverAction_({helpView.string = \"press the play button to play a note or press the keys on your board (q-i and y-, -> c-c', . and - are octave down and up)\"});\r\n\tvar freqBox = NumberBox().value_(400).minWidth_(50).maxWidth_(80).clipLo_(0).mouseOverAction_({helpView.string = \"basic frequency in Hz\";});\r\n\tvar waveformMenu = Array.fill(4, {|i|PopUpMenu().items_([\"SinOsc\",\"LFTri\",\"LFSaw\",\"WhiteNoise\"]).action_({modField.valueAction_(modField.value)}).mouseOverAction_({helpView.string = \"current waveform for oscillator \"++ b[i]})});\r\n\tvar harmBox = Array.fill(4, {|i| NumberBox().clipLo_(0.5).value_(1).mouseOverAction_({helpView.string = \"Number box: frequency of oscillator \"++ b[i] ++\" = freq * harm + fine\"})});\r\n\tvar fineBox = Array.fill(4, {|i| NumberBox().value_(0).mouseOverAction_({helpView.string = \"Number box: frequency of oscillator \"++ b[i] ++\" = freq * harm + fine\";})});\r\n\tvar phaseBox = Array.fill(4, {|i| NumberBox().clipLo_(-2pi).clipHi_(2pi).mouseOverAction_({helpView.string = \"Number box: Phase offset or modulator of oscillator \"++b[i]++\" in radians\"})});\r\n\tvar ampBox = Array.fill(4, {|i| NumberBox().clipLo_(0).value_(0.5).scroll_step_(0.1).mouseOverAction_({helpView.string = \"Number box: Output of oscillator \"++b[i]++\" will be multiplied by this value\"})});\r\n\tvar infoText = [\"osc\",\"wave\",\"harm\",\"fine\",\"phase\",\"amp\",\"a\",\"p\",\"d\",\"s\",\"r\",\"curve\",\"freq:\"];\r\n\tvar infoHelp = [\"Four oscillators with names a, b, c and d\", \"waveform that shall be synthesized\", \"harmonics are the number of partial in relation to the basic frequency\", \"fine tuning in Hz\", \"Phase offset or modulator in radians\", \"Output will be multiplied by this value\", \"attack Time\", \"peak Level\", \"decay Time\", \"sustain Level\", \"release Time\", \"The shapes of connections between the nodes of the envelope view\", \"basic frequency in Hz\"];\r\n\tvar info = Array.fill(infoText.size, {|i| StaticText().string_(infoText[i]).maxHeight_(10).stringColor_(stringColor).mouseOverAction_({helpView.string = infoHelp[i];})});\r\n\tvar w = Window(\"Operator\", Rect(250, 445, 722, 220));\r\n\tvar modField = TextField().string_(\"a\").mouseOverAction_({helpView.string = \"modulation Field: type your formula which describes how the four oscillators shall be modulated and press enter. Possible are + and * operations (e.g. a*b+c*d or a*a*b+d)\"});\r\n\tvar b = [\"a\",\"b\",\"c\",\"d\"];\r\n\tvar buttonColor = [Color.red, Color.green, Color.blue, Color.yellow];\r\n\tvar oscText = Array.fill(4, {|i| Button().states_([[b[i], Color.black, buttonColor[i]]]).maxWidth_(17).maxHeight_(18).mouseOverAction_({helpView.string = \"clicking on this button shows amplitude Envelope of oscillator \" ++ b[i]})});\r\n\tvar oscShow1 = Array.fill(4, {|i| Button().states_([[nil, nil, buttonColor[i]]]).maxWidth_(10).maxHeight_(10).mouseOverAction_({helpView.string = \"clicking on this button shows amplitude Envelope of oscillator \" ++ b[i]})});\r\n\tvar oscShow2 = Array.fill(4, {|i| Button().states_([[nil, nil, buttonColor[i]]]).maxWidth_(17).maxHeight_(18).mouseOverAction_({helpView.string = \"clicking on this button shows amplitude Envelope of oscillator \" ++ b[i]})});\r\n\tvar envStretch = 0.2;\r\n\tvar oct = 60;\r\n\tvar attackBox  = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(0)\r\n\t\t.clipHi_(10)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.value_(0.01)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({enV[i].value = [\r\n\t\t\t[0, attackBox[i].value*envStretch, attackBox[i].value + decayBox[i].value*envStretch, attackBox[i].value + decayBox[i].value+ releaseBox[i].value*envStretch],\r\n\t\t\t[0, peakBox[i].value, sustainBox[i].value, 0]];})\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: attack time of the amplitude envelope of oscillator \"++b[i]++\" in seconds\"})\r\n\t});\r\n\tvar peakBox = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(0)\r\n\t\t.clipHi_(1)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.value_(1)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({enV[i].value = [\r\n\t\t\t[0, attackBox[i].value*envStretch, attackBox[i].value + decayBox[i].value*envStretch, attackBox[i].value + decayBox[i].value+ releaseBox[i].value*envStretch],\r\n\t\t\t[0, peakBox[i].value, sustainBox[i].value, 0]];})\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: peak value of the amplitude envelope of oscillator \"++b[i]++\" between 0 and 1\"})\r\n\t});\r\n\tvar decayBox   = Array.fill(4, { |i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(0)\r\n\t\t.clipHi_(10)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.value_(0.3)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({enV[i].value = [\r\n\t\t\t[0, attackBox[i].value*envStretch, attackBox[i].value + decayBox[i].value*envStretch, attackBox[i].value + decayBox[i].value+ releaseBox[i].value*envStretch],\r\n\t\t\t[0, peakBox[i].value, sustainBox[i].value, 0]];})\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: decay time of the amplitude envelope of oscillator \"++b[i]++\" in seconds\"})\r\n\t});\r\n\tvar sustainBox = Array.fill(4, { |i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(0)\r\n\t\t.clipHi_(1)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.value_(0.5)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({enV[i].value = [\r\n\t\t\t[0, attackBox[i].value*envStretch, attackBox[i].value + decayBox[i].value*envStretch, attackBox[i].value + decayBox[i].value+ releaseBox[i].value*envStretch],\r\n\t\t\t[0, peakBox[i].value, sustainBox[i].value, 0]];})\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: sustain value of the amplitude envelope of oscillator \"++b[i]++\" between 0 and 1\"})\r\n\t});\r\n\tvar releaseBox = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(0)\r\n\t\t.clipHi_(20)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.value_(1)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({enV[i].value = [\r\n\t\t\t[0, attackBox[i].value*envStretch, attackBox[i].value + decayBox[i].value*envStretch, attackBox[i].value + decayBox[i].value+ releaseBox[i].value*envStretch],\r\n\t\t\t[0, peakBox[i].value, sustainBox[i].value, 0]];})\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: release time of the amplitude envelope of oscillator \"++b[i]++\" in seconds\"})\r\n\t});\r\n\tvar curveBox = Array.fill(6, {|i|\r\n\t\tNumberBox()\r\n\t\t.maxWidth_(60)\r\n\t\t.clipLo_(-16)\r\n\t\t.clipHi_(16)\r\n\t\t.scroll_step_(1)\r\n\t\t.value_(-3)\r\n\t\t.mouseDownAction_({aEnv.layout.index_(i);})\r\n\t\t.action_({|value| enV[i].curves = value.value  })\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: The shapes of connections between the nodes of the envelope view\"})\r\n\t});\r\n\r\n\t//OscEnvs\r\n\tvar envA = EnvelopeView()\r\n\t.value_([[0, attackBox[0].value*envStretch, attackBox[0].value + decayBox[0].value*envStretch, attackBox[0].value + decayBox[0].value+ releaseBox[0].value*envStretch], [0, peakBox[0].value, sustainBox[0].value, 0]])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(1,0,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.minWidth_(170)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator a´s amplitude is a visualization of the values of the adsr number boxes (only editable through number boxes)\"});\r\n\r\n\tvar envB = EnvelopeView()\r\n\t.value_([[0, attackBox[1].value*envStretch, attackBox[1].value + decayBox[1].value*envStretch, attackBox[1].value + decayBox[1].value+ releaseBox[1].value*envStretch], [0, peakBox[0].value, sustainBox[1].value, 0]])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(0,1,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4\r\n\t).background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator b´s amplitude is a visualization of the values of the adsr number boxes (only editable through number boxes)\"});\r\n\r\n\tvar envC = EnvelopeView()\r\n\t.value_([[0, attackBox[2].value*envStretch, attackBox[2].value + decayBox[2].value*envStretch, attackBox[2].value + decayBox[2].value+ releaseBox[2].value*envStretch], [0, peakBox[0].value, sustainBox[2].value, 0]])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(0,0,1))\r\n\t.editable_(false).alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator c´s amplitude is a visualization of the values of the adsr number boxes (only editable through number boxes)\"});\r\n\r\n\tvar envD = EnvelopeView()\r\n\t.value_([[0, attackBox[3].value*envStretch, attackBox[3].value + decayBox[3].value*envStretch, attackBox[3].value + decayBox[3].value+ releaseBox[3].value*envStretch], [0, peakBox[0].value, sustainBox[3].value, 0]])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(1,1,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator d´s amplitude is a visualization of the values of the adsr number boxes (only editable through number boxes)\"});\r\n\r\n\t//pitchEnvs\r\n\r\n\tvar pitchEnvA = EnvelopeView()\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(1,0,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.minWidth_(170)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator a´s pitch. Visualization of the values of the number boxes. The first node represents the start point, the second the sustain point and the third the end point\"});\r\n\r\n\tvar pitchEnvB = EnvelopeView()\r\n\t.value_()\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(0,1,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4\r\n\t).background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator b´s pitch. Visualization of the values of the number boxes. The first node represents the start point, the second the sustain point and the third the end point\"});\r\n\r\n\tvar pitchEnvC = EnvelopeView()\r\n\t.value_()\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(0,0,1))\r\n\t.editable_(false).alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator c´s pitch. Visualization of the values of the number boxes. The first node represents the start point, the second the sustain point and the third the end point\"});\r\n\r\n\tvar pitchEnvD = EnvelopeView()\r\n\t.value_()\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(1,1,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of oscillator d´s pitch. Visualization of the values of the number boxes. The first node represents the start point, the second the sustain point and the third the end point\"});\r\n\r\n\r\n\t//FX\r\n\r\n\tvar lfoStart = NumberBox().value_(1).clipLo_(0).action_({enV[4].value =\r\n\t\t[\r\n\t\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: start frequency of the lfo\"});\r\n\tvar lfoSustain = NumberBox().value_(1).clipLo_(0).action_({enV[4].value =\r\n\t\t[\r\n\t\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: sustain frequency of the lfo\"});\r\n\tvar lfoEnd = NumberBox().value_(1).clipLo_(0).action_({enV[4].value =\r\n\t\t[\r\n\t\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: end frequency of the lfo\"});\r\n\tvar lfoAttack = NumberBox().value_(0.1).clipLo_(0).scroll_step_(0.1).action_({enV[4].value =\r\n\t\t[\r\n\t\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: attack time of the lfo in seconds\"});\r\n\tvar lfoRelease = NumberBox().value_(1).clipLo_(0).scroll_step_(0.1).action_({enV[4].value =\r\n\t\t[\r\n\t\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: release time of the lfo in seconds\"});\r\n\tvar lfoPhase = NumberBox().value_(0).clipLo_(-2pi).clipHi_(2pi).mouseOverAction_({helpView.string = \"Number box: phase shift of the lfo in radians. Value is between -2pi and +2pi\"});\r\n\r\n\tvar filterStart = NumberBox().value_(0).clipLo_(-100).action_({enV[5].value =\r\n\t\t[\r\n\t\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t\t[filterStart.value/2000+0.5, filterSustain.value/2000+0.5, filterEnd.value/2000+0.5]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: start point of the frequency filter in percentual relation to the basic frequency\"});\r\n\tvar filterSustain = NumberBox().value_(0).clipLo_(-100).action_({enV[5].value =\r\n\t\t[\r\n\t\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t\t[filterStart.value/2000+0.5, filterSustain.value/2000+0.5, filterEnd.value/2000+0.5]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: sustain point of the frequency filter in percentual relation to the basic frequency\"});\r\n\tvar filterEnd = NumberBox().value_(0).clipLo_(-100).action_({enV[5].value =\r\n\t\t[\r\n\t\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t\t[filterStart.value/2000+0.5, filterSustain.value/2000+0.5, filterEnd.value/2000+0.5]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: end point of the frequency filter in percentual relation to the basic frequency\"});\r\n\tvar filterAttack = NumberBox().value_(0.1).clipLo_(0).scroll_step_(0.1).action_({enV[5].value =\r\n\t\t[\r\n\t\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t\t[filterStart.value/2000+0.5, filterSustain.value/2000+0.5, filterEnd.value/2000+0.5]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: attack time of the frequency filter in seconds\"});\r\n\tvar filterRelease = NumberBox().value_(1).clipLo_(0).scroll_step_(0.1).action_({enV[5].value =\r\n\t\t[\r\n\t\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t\t[filterStart.value/2000+0.5, filterSustain.value/2000+0.5, filterEnd.value/2000+0.5]\r\n\t]}).mouseOverAction_({helpView.string = \"Number box: release time of the frequency filter in seconds\"});\r\n\tvar rq = NumberBox().value_(1).clipLo_(0).clipHi_(1).scroll_step_(0.1).mouseOverAction_({helpView.string = \"Number box: resonance of the frequency filter. 1 is the minimum and 0 the maximum\"});\r\n\r\n\tvar lfoEnv = EnvelopeView()\r\n\t.value_([\r\n\t\t[0, lfoAttack.value*envStretch, lfoAttack.value + lfoRelease.value * envStretch],\r\n\t\t[lfoStart.value/100, lfoSustain.value/100, lfoEnd.value/100]\r\n\t])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.black)\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of the low frequency oscillator (lfo)\"});\r\n\r\n\tvar filterEnv = EnvelopeView()\r\n\t.value_([\r\n\t\t[0, filterAttack.value*envStretch, filterAttack.value + filterRelease.value * envStretch],\r\n\t\t[filterStart.value/500+0.5, filterSustain.value/500+0.5, filterEnd.value/500+0.5]\r\n\t])\r\n\t.thumbSize_(7)\r\n\t.strokeColor_(Color.new(1,1,0))\r\n\t.editable_(false)\r\n\t.alpha_(0.4)\r\n\t.background_(Color.new(1,1,1,0.1))\r\n\t.curves_(-3)\r\n\t.mouseOverAction_({helpView.string = \"envelope view of the frequency filter\"});\r\n\r\n\tvar enV = [ envA, envB, envC, envD, lfoEnv, filterEnv, pitchEnvA, pitchEnvB, pitchEnvC, pitchEnvD];\r\n\r\n\tvar aEnv = View().layout_(StackLayout(\r\n\t\tenV[0],\r\n\t\tenV[1],\r\n\t\tenV[2],\r\n\t\tenV[3];\r\n\t).mode_(1));\r\n\r\n\tvar bEnv = View().layout_(StackLayout(\r\n\t\tenV[6],\r\n\t\tenV[7],\r\n\t\tenV[8],\r\n\t\tenV[9];\r\n\t).mode_(1));\r\n\r\n\t//Keys\r\n\tvar keyDict = ();\r\n\r\n\t//SAVE\r\n\r\n\tvar saveModus = Button().states_([[\"SAVE\"], [\"SAVE\", Color.black, Color.gray]]).action_({|value| stackLayout.index = 3; oscButton.value = 0; pitchButton.value = 0; fxButton.value = 0; value.value = 1;}).mouseOverAction_({helpView.string = \"this button opens the save view. Different settings can be stored in a list within the operator\"}).enabled_(false);\r\n\r\n\t//Views\r\n\tvar helpButton = Button().states_([[\"help\", Color.black],[\"help:\", Color.black, Color.gray]]).action_({|value| if(value.value == 0, {w.acceptsMouseOver_(false); helpView.string=\"\";}, {\r\n\t\tw.acceptsMouseOver_(true);\r\n\t\thelpView.string = \"move your mouse over the  number boxes and Views to see their description. Click on a number box and move the mouse up and down to change the values in it\";\r\n\t})}).mouseOverAction_({helpView.string = \"move your mouse over the  number boxes and Views. Click on a number box and move the mouse up and down to change the values in it\";});\r\n\tvar helpView = StaticText().string_(\"\").minWidth_(750).stringColor_(stringColor); // minWidth was 450\r\n\tvar oscButton = Button().states_([[\"OSC\"], [\"OSC\", Color.black, Color.gray]]).action_({|v| stackLayout.index = 0; fxButton.value = 0; pitchButton.value = 0; saveModus.value = 0; v.value = 1}).mouseOverAction_({helpView.string = \"this button opens the oscillator view. Here you can set values for four oscillators\"});\r\n\tvar fxButton = Button().states_([[\"FX\"], [\"FX\", Color.black, Color.gray]]).action_({|v| stackLayout.index = 1; oscButton.value = 0; pitchButton.value = 0; saveModus.value = 0; v.value = 1}).mouseOverAction_({helpView.string = \"this button opens the fx view. Here you can set effect values for a low frequency oscillator (lfo) and a frequency filter\"});\r\n\tvar pitchButton = Button().states_([[\"PITCH\"], [\"PITCH\", Color.black, Color.gray]]).action_({|v| stackLayout.index = 2; oscButton.value = 0; fxButton.value = 0; saveModus.value = 0; v.value = 1}).mouseOverAction_({helpView.string = \"this button opens the pitch view. Here you can set pitch envelopes for each oscillator\"});\r\n\tvar modus = View().layout_(HLayout(oscButton, pitchButton, fxButton, saveModus, helpButton, helpView)).maxHeight_(50);\r\n\r\n\tvar lfoMenu = PopUpMenu().items_([\"off\",\"sine\", \"tri\", \"saw\"]).mouseOverAction_({helpView.string = \"shows the current waveform of the lfo\"});\r\n\tvar filterMenu = PopUpMenu().items_([\"off\",\"BPF\", \"LPF\", \"HPF\"]).mouseOverAction_({helpView.string = \"shows the current filter art. BPF->Band Pass Filter, LPF->Low Pass Filter, HPF->High Pass Filter\"});\r\n\r\n\r\n\tvar oscView = View().background_(Color.gray(0.2,0.8)).layout_(GridLayout.rows(\r\n\t\t[info[0], info[1], info[2], info[3], info[4], info[5], nil,nil, info[6], info[7], info[8], info[9], info[10], info[11]],\r\n\t\t[oscText[0], waveformMenu[0], harmBox[0], fineBox[0], phaseBox[0], ampBox[0],  [aEnv, rows:4], oscShow2[0],attackBox[0], peakBox[0], decayBox[0], sustainBox[0], releaseBox[0], curveBox[0]],\r\n\t\t[oscText[1], waveformMenu[1], harmBox[1], fineBox[1], phaseBox[1], ampBox[1],nil, oscShow2[1],attackBox[1], peakBox[1], decayBox[1], sustainBox[1], releaseBox[1],curveBox[1]],\r\n\t\t[oscText[2], waveformMenu[2], harmBox[2], fineBox[2], phaseBox[2], ampBox[2],nil,oscShow2[2], attackBox[2], peakBox[2], decayBox[2], sustainBox[2], releaseBox[2],curveBox[2]],\r\n\t\t[oscText[3], waveformMenu[3], harmBox[3], fineBox[3], phaseBox[3], ampBox[3],nil, oscShow2[3],attackBox[3], peakBox[3], decayBox[3], sustainBox[3], releaseBox[3],curveBox[3]],\r\n\t\t[[modField, columns: 14]]\r\n\t));\r\n\r\n\r\n\tvar pitchStart = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.value_(0)\r\n\t\t.clipLo_(-100)\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: Start point of the pitch Envelope in percent and relation to the basic frequency\"})\r\n\t\t.action_({\r\n\t\t\tbEnv.layout.index = i;\r\n\t\t\tenV[i+6].value = [[0, pitchAttack[i].value/5, pitchAttack[i].value+pitchRelease[i].value/5],[(pitchStart[i].value/200)+0.5, (pitchSustain[i].value/200)+0.5, (pitchEnd[i].value/200)+0.5]]})\r\n\t});//percent of freq\r\n\tvar pitchSustain = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.value_(0)\r\n\t\t.clipLo_(-100)\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: Sustain point of the pitch Envelope in percent and relation to the basic frequency\"})\r\n\t\t.action_({\r\n\t\t\tbEnv.layout.index = i;\r\n\t\t\tenV[i+6].value = [[0, pitchAttack[i].value/5, pitchAttack[i].value+pitchRelease[i].value/5],[pitchStart[i].value/200+0.5, pitchSustain[i].value/200+0.5, pitchEnd[i].value/200+0.5]]})\r\n\t});\r\n\tvar pitchEnd = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.value_(0)\r\n\t\t.clipLo_(-100)\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: End point of the pitch Envelope in percent and relation to the basic frequency\"})\r\n\t\t.action_({\r\n\t\t\tbEnv.layout.index = i;\r\n\t\t\tenV[i+6].value = [[0, pitchAttack[i].value/5, pitchAttack[i].value+pitchRelease[i].value/5],[pitchStart[i].value/200+0.5, pitchSustain[i].value/200+0.5, pitchEnd[i].value/200+0.5]]})\r\n\t});\r\n\tvar pitchAttack = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.value_(0.1)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.clipLo_(0)\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: Attack time of the pitch Envelope in Seconds\"})\r\n\t\t.action_({\r\n\t\t\tbEnv.layout.index = i;\r\n\t\t\tenV[i+6].value = [[0, pitchAttack[i].value/5, pitchAttack[i].value+pitchRelease[i].value/5],[pitchStart[i].value/200+0.5, pitchSustain[i].value/200+0.5, pitchEnd[i].value/200+0.5]]})\r\n\t});\r\n\tvar pitchRelease = Array.fill(4, {|i|\r\n\t\tNumberBox()\r\n\t\t.value_(0.1)\r\n\t\t.scroll_step_(0.1)\r\n\t\t.clipLo_(0)\r\n\t\t.mouseOverAction_({helpView.string = \"Number box: Release time of the pitch Envelope in Seconds\"})\r\n\t\t.action_({\r\n\t\t\tbEnv.layout.index = i;\r\n\t\t\tenV[i+6].value = [[0, pitchAttack[i].value/5, pitchAttack[i].value+pitchRelease[i].value/5],[pitchStart[i].value/200+0.5, pitchSustain[i].value/200+0.5, pitchEnd[i].value/200+0.5]]})\r\n\t});\r\n\tvar oscText2 = Array.fill(4, {|i| Button().states_([[b[i], Color.black, buttonColor[i]]]).maxWidth_(17).maxHeight_(18).mouseOverAction_({helpView.string = \"clicking on this button shows pitch envelope of oscillator \"++b[i]})});\r\n\tvar pitchInfoText = [\"osc\", \"start\", \"sustain\", \"end\", \"attack\", \"release\"];\r\n\tvar pitchInfoHelp = [\r\n\t\t\"four oscilltaors with names a, b, c and d\",\r\n\t\t\"Start point of the pitch Envelope in percent and relation to the basic frequency\",\r\n\t\t\"Sustain point of the pitch Envelope in percent and relation to the basic frequency\",\r\n\t\t\"End point of the pitch Envelope in percent and relation to the basic frequency\",\r\n\t\t\"Attack time of the pitch Envelope in Seconds\",\r\n\t\t\"Release time of the pitch Envelope in Seconds\"\r\n\t];\r\n\tvar pitchInfo = Array.fill(pitchInfoText.size, {|i| StaticText().string_(pitchInfoText[i]).maxHeight_(10).stringColor_(stringColor).mouseOverAction_({helpView.string = pitchInfoHelp[i]})});\r\n\r\n\tvar modText = StaticText().string_(\"a\").stringColor_(stringColor).mouseOverAction_({helpView.string = \"moudulation formula (only editable in osc view)\"});\r\n\tvar pitchLayout = GridLayout.rows(\r\n\t\t[pitchInfo[0], pitchInfo[1], pitchInfo[2], pitchInfo[3], pitchInfo[4], pitchInfo[5], pitchInfo[6], pitchInfo[7]],\r\n\t\t[oscText2[0], pitchStart[0], pitchSustain[0], pitchEnd[0], pitchAttack[0], pitchRelease[0], [bEnv, rows: 4]],\r\n\t\t[oscText2[1], pitchStart[1], pitchSustain[1], pitchEnd[1], pitchAttack[1], pitchRelease[1]],\r\n\t\t[oscText2[2], pitchStart[2], pitchSustain[2], pitchEnd[2], pitchAttack[2], pitchRelease[2]],\r\n\t\t[oscText2[3], pitchStart[3], pitchSustain[3], pitchEnd[3], pitchAttack[3], pitchRelease[3]],\r\n\t\t[[modText, columns:7]]\r\n\t);\r\n\tvar pitchView = View().layout_(pitchLayout).background_(Color.gray(0.2,0.8));\r\n\r\n\t//FXView\r\n\r\n\tvar panner = NumberBox().minWidth_(40).maxWidth_(50).clipLo_(-1).clipHi_(1).value_(0).scroll_step_(0.1).action_({|value| fx.set(\\pos, value.value)}).mouseOverAction_({helpView.string = \"Number Box: pans the signal on the left or right speaker. -1 is the left and 1 is the right one\"});\r\n\r\n\t\tvar delayTime = NumberBox().clipLo_(0).clipHi_(1).scroll_step_(0.1).value_(0).action_({|value| fx.set(\\delayTime, value.value)}).mouseOverAction_({helpView.string = \"Delay time in seconds.\"});\r\n\tvar decayTime = NumberBox().clipLo_(-1).clipHi_(1).scroll_step_(0.1).value_(0.3).action_({|value| fx.set(\\decayTime, value.value)}).mouseOverAction_({helpView.string = \"Time for the echoes to decay by 60 decibels. If this time is negative then the feedback coefficient will be negative, thus emphasizing only odd harmonics at an octave lower.\"});\r\n\r\n\tvar level = NumberBox().minWidth_(40).maxWidth_(50).clipLo_(0).clipHi_(2).scroll_step_(0.1).value_(1).action_({|value| fx.set(\\level, value.value)}).mouseOverAction_({helpView.string = \"Master Levelmeter\"});\r\n\r\n\tvar fxLayout = GridLayout.rows(\r\n\t\t[StaticText().string_(\"Envelope\").stringColor_(stringColor).minWidth_(70), nil, StaticText().string_(\"start\").stringColor_(stringColor), StaticText().string_(\"sustain\").stringColor_(stringColor), StaticText().string_(\"end\").stringColor_(stringColor),  StaticText().string_(\"attack\").stringColor_(stringColor), StaticText().string_(\"release\").stringColor_(stringColor), StaticText().string_(\"curve\").stringColor_(stringColor),nil],\r\n\t\t[StaticText().string_(\"lfo\").stringColor_(stringColor).minWidth_(70), lfoMenu, lfoStart, lfoSustain, lfoEnd, lfoAttack, lfoRelease, curveBox[4], lfoEnv, StaticText().string_(\"phase\").stringColor_(stringColor), lfoPhase],\r\n\t\t[StaticText().string_(\"filter\").stringColor_(stringColor).minWidth_(70), filterMenu, filterStart, filterSustain, filterEnd, filterAttack, filterRelease, curveBox[5], filterEnv, StaticText().string_(\"rq\").stringColor_(stringColor), rq],\r\n\t\t[\r\n\t\t\tnil,\r\n\t\t\tStaticText().string_(\"delayTime\").stringColor_(stringColor),\r\n\t\t\tStaticText().string_(\"decay\").stringColor_(stringColor)\r\n\t\t],\r\n\t\t[\r\n\t\t\tStaticText().string_(\"Delay:\").stringColor_(stringColor),\r\n\t\t\tdelayTime,\r\n\t\t\tdecayTime\r\n\t\t]\r\n\r\n\t);\r\n\r\n\tvar fxView = View().background_(Color.gray(0.2,0.8)).layout_(fxLayout);\r\n\r\n\tvar stackLayout = StackLayout(oscView,fxView, pitchView);\r\n\tvar stackView = View().layout_(stackLayout);\r\n\r\n\t//Interaction\r\n\tvar lll = String.new;//Zwischenspeicher für ll an iter Stelle\r\n\r\n\tvar synthBuildFunc = {\r\n\r\n\t\tpoint.do{|item, i|\r\n\t\t\tswitch(item.size,\r\n\t\t\t\t1, {[\"ll[i].isString: \"++ll[i].isString].postln;\r\n\t\t\t\t\tSynthDef.new(ll[i].asSymbol,{\r\n\t\t\t\t\t\targ freq, freqMul0, fine0, phase0, mul0, gate=1, lfoIndex = 0, lfoPhase = 0, filterIndex = 0, rq = 1, out;\r\n\t\t\t\t\t\tvar snd, env, envctl, ampEnv, pitchEnv0, pitchEnvctl0, pitch0, lfoEnv, lfoEnvctl, lfoFreq, lfo, filterEnv, filterEnvctl, filterFreq, filter;\r\n\r\n\t\t\t\t\t\tenv = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl = \\env0.kr(env.asArray);\r\n\t\t\t\t\t\tampEnv = EnvGen.kr(envctl, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tpitchEnv0 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl0 = \\pitchEnv0.kr(pitchEnv0.asArray);\r\n\t\t\t\t\t\tpitch0 = EnvGen.kr(pitchEnvctl0, gate);\r\n\r\n\t\t\t\t\t\tlfoEnv = Env.newClear(4);\r\n\t\t\t\t\t\tlfoEnvctl = \\lfoEnv.kr(lfoEnv.asArray);\r\n\t\t\t\t\t\tlfoFreq = EnvGen.kr(lfoEnvctl, gate);\r\n\t\t\t\t\t\tlfo = [ SinOsc.ar(0, 0, 0.1, 1) , SinOsc.ar(lfoFreq, lfoPhase), LFTri.ar(lfoFreq, lfoPhase), LFSaw.ar(lfoFreq, lfoPhase)];\r\n\r\n\t\t\t\t\t\tfilterEnv = Env.newClear(4);\r\n\t\t\t\t\t\tfilterEnvctl = \\filterEnv.kr(filterEnv.asArray);\r\n\t\t\t\t\t\tfilterFreq = EnvGen.kr( filterEnvctl, gate);\r\n\r\n\t\t\t\t\t\tif (ll[i] == \"WhiteNoise\", {snd = ll[i].interpret.ar(mul0)}, {snd = ll[i].interpret.ar(freq*freqMul0+fine0+pitch0, phase0, mul0)});\r\n\r\n\t\t\t\t\t\tsnd = snd * ampEnv*Select.ar(lfoIndex, lfo);\r\n\t\t\t\t\t\tfilter = [snd, BPF.ar( snd, filterFreq, rq), RLPF.ar( snd, filterFreq, rq), RHPF.ar( snd, filterFreq, rq)];\r\n\t\t\t\t\t\tsnd = Select.ar(filterIndex, filter);\r\n\t\t\t\t\t\tOut.ar(out, snd);\r\n\t\t\t\t\t}).add;\r\n\t\t\t\t},\r\n\t\t\t\t3, {\r\n\t\t\t\t\tlll = ll[i].split($*);\r\n\t\t\t\t\tSynthDef(l[i].asSymbol,\r\n\t\t\t\t\t\t{|freq,freqMul0=1,freqMul1=1,fine0=0,fine1=0, phase0=0, phase1=0, mul0=0.5, mul1=0.5,gate=1, lfoIndex = 0, lfoPhase = 0, filterIndex = 0, rq = 1, out|\r\n\t\t\t\t\t\t\tvar snd,snd0, snd1, env0,env1,envctl0,envctl1,ampEnv0,ampEnv1,lfoEnv,lfoEnvctl,lfoFreq,lfo, pitchEnv0, pitchEnvctl0, pitch0, pitchEnv1, pitchEnvctl1, pitch1, filterEnv, filterEnvctl, filterFreq, filter;\r\n\r\n\t\t\t\t\t\t\tenv0 = Env.newClear(4);\r\n\t\t\t\t\t\t\tenvctl0 = \\env0.kr(env0.asArray);\r\n\t\t\t\t\t\t\tampEnv0 = EnvGen.kr(envctl0, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\t\tenv1 = Env.newClear(4);\r\n\t\t\t\t\t\t\tenvctl1 = \\env1.kr(env1.asArray);\r\n\t\t\t\t\t\t\tampEnv1 = EnvGen.kr(envctl1, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\t\tlfoEnv = Env.newClear(4);\r\n\t\t\t\t\t\t\tlfoEnvctl = \\lfoEnv.kr(lfoEnv.asArray);\r\n\t\t\t\t\t\t\tlfoFreq = EnvGen.kr(lfoEnvctl, gate);\r\n\t\t\t\t\t\t\tlfo = [SinOsc.ar(0, 0, 0.1, 1), SinOsc.ar(lfoFreq, lfoPhase), LFTri.ar(lfoFreq, lfoPhase), LFSaw.ar(lfoFreq, lfoPhase)];\r\n\r\n\t\t\t\t\t\t\tpitchEnv0 = Env.newClear();\r\n\t\t\t\t\t\t\tpitchEnvctl0 = \\pitchEnv0.kr(pitchEnv0.asArray);\r\n\t\t\t\t\t\t\tpitch0 = EnvGen.kr(pitchEnvctl0, gate);\r\n\r\n\t\t\t\t\t\t\tpitchEnv1 = Env.newClear();\r\n\t\t\t\t\t\t\tpitchEnvctl1 = \\pitchEnv1.kr(pitchEnv1.asArray);\r\n\t\t\t\t\t\t\tpitch1 = EnvGen.kr(pitchEnvctl1, gate);\r\n\r\n\t\t\t\t\t\t\tfilterEnv = Env.newClear(4);\r\n\t\t\t\t\t\t\tfilterEnvctl = \\filterEnv.kr(filterEnv.asArray);\r\n\t\t\t\t\t\t\tfilterFreq = EnvGen.kr( filterEnvctl, gate);\r\n\r\n\t\t\t\t\t\t\tif(lll[0] == \"WhiteNoise\", {snd0 = lll[0].interpret.ar(mul0);}, {snd0 = lll[0].interpret.ar(freq*freqMul0+fine0+pitch0, phase0, mul0);});\r\n\t\t\t\t\t\t\tif(lll[1] == \"WhiteNoise\", {snd1 = lll[1].interpret.ar(mul1);}, {snd1 = lll[1].interpret.ar(freq*freqMul1+fine1+pitch1, phase1, mul1);});\r\n\r\n\t\t\t\t\t\t\tsnd0 = snd0 * ampEnv0;\r\n\t\t\t\t\t\t\tsnd1 = snd1 * ampEnv1;\r\n\t\t\t\t\t\t\tsnd = snd0*snd1*Select.ar(lfoIndex, lfo);\r\n\r\n\t\t\t\t\t\t\tfilter = [snd, BPF.ar( snd, filterFreq, rq), RLPF.ar( snd, filterFreq, rq), RHPF.ar( snd, filterFreq, rq)];\r\n\t\t\t\t\t\t\tsnd = Select.ar(filterIndex, filter);\r\n\r\n\t\t\t\t\t\t\tOut.ar(out, snd);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t).add;\r\n\t\t\t\t},\r\n\t\t\t\t5, {\r\n\t\t\t\t\tlll = ll[i].split($*);\r\n\t\t\t\t\tSynthDef(l[i].asSymbol, {\r\n\t\t\t\t\t\t|freq,freqMul0=1, freqMul1=1, freqMul2 = 1,fine0=0,fine1=0,fine2=0, phase0=0,phase1=0,phase2=0,mul0=0.5,mul1=0.5,mul2=0.5,gate=1, lfoIndex = 0, lfoPhase = 0, filterIndex = 0, rq = 1, out|\r\n\t\t\t\t\t\tvar snd, snd0,snd1,snd2,env0,env1,env2,envctl0,envctl1,envctl2,ampEnv0,ampEnv1,ampEnv2,lfoEnv,lfoEnvctl,lfoFreq,lfo, pitchEnv0, pitchEnvctl0, pitch0, pitchEnv1, pitchEnvctl1, pitch1, pitchEnv2, pitchEnvctl2, pitch2, filterEnv, filterEnvctl, filterFreq, filter;\r\n\r\n\t\t\t\t\t\tenv0 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl0 = \\env0.kr(env0.asArray);\r\n\t\t\t\t\t\tampEnv0 = EnvGen.kr(envctl0, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tenv1 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl1 = \\env1.kr(env1.asArray);\r\n\t\t\t\t\t\tampEnv1 = EnvGen.kr(envctl1, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tenv2 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl2 = \\env2.kr(env2.asArray);\r\n\t\t\t\t\t\tampEnv2 = EnvGen.kr(envctl2, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tlfoEnv = Env.newClear(4);\r\n\t\t\t\t\t\tlfoEnvctl = \\lfoEnv.kr(lfoEnv.asArray);\r\n\t\t\t\t\t\tlfoFreq = EnvGen.kr(lfoEnvctl, gate);\r\n\t\t\t\t\t\tlfo = [SinOsc.ar(0, 0, 0.1, 1), SinOsc.ar(lfoFreq, lfoPhase), LFTri.ar(lfoFreq, lfoPhase), LFSaw.ar(lfoFreq, lfoPhase)];\r\n\r\n\t\t\t\t\t\tpitchEnv0 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl0 = \\pitchEnv0.kr(pitchEnv0.asArray);\r\n\t\t\t\t\t\tpitch0 = EnvGen.kr(pitchEnvctl0, gate);\r\n\r\n\t\t\t\t\t\tpitchEnv1 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl1 = \\pitchEnv1.kr(pitchEnv1.asArray);\r\n\t\t\t\t\t\tpitch1 = EnvGen.kr(pitchEnvctl1, gate);\r\n\r\n\t\t\t\t\t\tpitchEnv2 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl2 = \\pitchEnv2.kr(pitchEnv2.asArray);\r\n\t\t\t\t\t\tpitch2 = EnvGen.kr(pitchEnvctl2, gate);\r\n\r\n\t\t\t\t\t\tfilterEnv = Env.newClear(4);\r\n\t\t\t\t\t\tfilterEnvctl = \\filterEnv.kr(filterEnv.asArray);\r\n\t\t\t\t\t\tfilterFreq = EnvGen.kr( filterEnvctl, gate);\r\n\r\n\t\t\t\t\t\tif(lll[0] == \"WhiteNoise\", {snd0 = lll[0].interpret.ar(mul0);}, {snd0 = lll[0].interpret.ar(freq*freqMul0+fine0+pitch0, phase0, mul0);});\r\n\t\t\t\t\t\tif(lll[1] == \"WhiteNoise\", {snd1 = lll[1].interpret.ar(mul1);}, {snd1 = lll[1].interpret.ar(freq*freqMul1+fine1+pitch1, phase1, mul1);});\r\n\t\t\t\t\t\tif(lll[3] == \"WhiteNoise\", {snd2 = lll[2].interpret.ar(mul2);}, {snd2 = lll[2].interpret.ar(freq*freqMul2+fine2+pitch2, phase2, mul2);});\r\n\r\n\t\t\t\t\t\tsnd0 = snd0 * ampEnv0;\r\n\t\t\t\t\t\tsnd1 = snd1 * ampEnv1;\r\n\t\t\t\t\t\tsnd2 = snd2 * ampEnv2;\r\n\t\t\t\t\t\tsnd = snd0*snd1*snd2*Select.ar(lfoIndex, lfo);\r\n\r\n\t\t\t\t\t\tfilter = [snd, BPF.ar( snd, filterFreq, rq), RLPF.ar( snd, filterFreq, rq), RHPF.ar( snd, filterFreq, rq)];\r\n\t\t\t\t\t\tsnd = Select.ar(filterIndex, filter);\r\n\r\n\t\t\t\t\t\tOut.ar(out, snd )\r\n\t\t\t\t\t}).add;\r\n\t\t\t\t},\r\n\t\t\t\t7, {\r\n\t\t\t\t\tlll = ll[i].split($*);\r\n\t\t\t\t\tSynthDef(l[i].asSymbol, {\r\n\t\t\t\t\t\t|freq, freqMul0=1, freqMul1=1, freqMul2 = 1, freqMul3 = 1,fine0=0,fine1=0,fine2=0,fine3=0,phase0=0,phase1=0,phase2=0,phase3=0, mul0=0.5,mul1=0.5,mul2=0.5,mul3=0.5, gate=1, lfoIndex = 0, lfoPhase = 0, filterIndex = 0, rq = 0, out|\r\n\t\t\t\t\t\tvar snd, snd0,snd1,snd2,snd3,env0,env1,env2,env3,envctl0,envctl1,envctl2,envctl3,ampEnv0,ampEnv1,ampEnv2,ampEnv3,lfoEnv,lfoEnvctl,lfoFreq,lfo, pitchEnv0, pitchEnvctl0, pitch0, pitchEnv1, pitchEnvctl1, pitch1, pitchEnv2, pitchEnvctl2, pitch2, pitchEnv3, pitchEnvctl3, pitch3, filterEnv, filterEnvctl, filterFreq, filter;\r\n\r\n\t\t\t\t\t\tenv0 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl0 = \\env0.kr(env0.asArray);\r\n\t\t\t\t\t\tampEnv0 = EnvGen.kr(envctl0, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tenv1 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl1 = \\env1.kr(env1.asArray);\r\n\t\t\t\t\t\tampEnv1 = EnvGen.kr(envctl1, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tenv2 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl2 = \\env2.kr(env2.asArray);\r\n\t\t\t\t\t\tampEnv2 = EnvGen.kr(envctl2, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tenv3 = Env.newClear(4);\r\n\t\t\t\t\t\tenvctl3 = \\env3.kr(env3.asArray);\r\n\t\t\t\t\t\tampEnv3 = EnvGen.kr(envctl3, gate, doneAction: 2);\r\n\r\n\t\t\t\t\t\tlfoEnv = Env.newClear(4);\r\n\t\t\t\t\t\tlfoEnvctl = \\lfoEnv.kr(lfoEnv.asArray);\r\n\t\t\t\t\t\tlfoFreq = EnvGen.kr(lfoEnvctl, gate);\r\n\t\t\t\t\t\tlfo = [SinOsc.ar(0, 0, 0.1, 1), SinOsc.ar(lfoFreq, lfoPhase), LFTri.ar(lfoFreq, lfoPhase), LFSaw.ar(lfoFreq, lfoPhase)];\r\n\r\n\t\t\t\t\t\tpitchEnv0 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl0 = \\pitchEnv0.kr(pitchEnv0.asArray);\r\n\t\t\t\t\t\tpitch0 = EnvGen.kr(pitchEnvctl0, gate);\r\n\r\n\t\t\t\t\t\tpitchEnv1 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl1 = \\pitchEnv1.kr(pitchEnv1.asArray);\r\n\t\t\t\t\t\tpitch1 = EnvGen.kr(pitchEnvctl1, gate);\r\n\r\n\t\t\t\t\t\tpitchEnv2 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl2 = \\pitchEnv2.kr(pitchEnv2.asArray);\r\n\t\t\t\t\t\tpitch2 = EnvGen.kr(pitchEnvctl2, gate);\r\n\r\n\t\t\t\t\t\tpitchEnv3 = Env.newClear();\r\n\t\t\t\t\t\tpitchEnvctl3 = \\pitchEnv2.kr(pitchEnv3.asArray);\r\n\t\t\t\t\t\tpitch3 = EnvGen.kr(pitchEnvctl3, gate);\r\n\r\n\t\t\t\t\t\tfilterEnv = Env.newClear(4);\r\n\t\t\t\t\t\tfilterEnvctl = \\filterEnv.kr(filterEnv.asArray);\r\n\t\t\t\t\t\tfilterFreq = EnvGen.kr( filterEnvctl, gate);\r\n\r\n\t\t\t\t\t\tif(lll[0] == \"WhiteNoise\", {snd0 = lll[0].interpret.ar(mul0)},{snd0 = lll[0].interpret.ar(freq*freqMul0+fine0+pitch0, phase0, mul0)});\r\n\t\t\t\t\t\tif(lll[1] == \"WhiteNoise\", {snd1 = lll[1].interpret.ar(mul1)},{snd1 = lll[1].interpret.ar(freq*freqMul1+fine1+pitch1, phase1, mul1)});\r\n\t\t\t\t\t\tif(lll[2] == \"WhiteNoise\", {snd2 = lll[2].interpret.ar(mul2)},{snd2 = lll[2].interpret.ar(freq*freqMul2+fine2+pitch2, phase2, mul2)});\r\n\t\t\t\t\t\tif(lll[3] == \"WhiteNoise\", {snd3 = lll[3].interpret.ar(mul3)},{snd3 = lll[3].interpret.ar(freq*freqMul3+fine3+pitch3, phase3, mul3)});\r\n\r\n\t\t\t\t\t\tsnd0 = snd0 * ampEnv0;\r\n\t\t\t\t\t\tsnd1 = snd1 * ampEnv1;\r\n\t\t\t\t\t\tsnd2 = snd2 * ampEnv2;\r\n\t\t\t\t\t\tsnd3 = snd3 * ampEnv3;\r\n\t\t\t\t\t\tsnd = snd0*snd1*snd2*snd3*Select.ar(lfoIndex, lfo);\r\n\r\n\t\t\t\t\t\tfilter = [snd, BPF.ar( snd, filterFreq, rq), RLPF.ar( snd, filterFreq, rq), RHPF.ar( snd, filterFreq, rq)];\r\n\t\t\t\t\t\tsnd = Select.ar(filterIndex, filter);\r\n\r\n\t\t\t\t\t\tOut.ar(out, snd);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t).add;\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t};\r\n\r\n\t};\r\n\r\n\t/*\r\n\tvar fx;\r\n\tvar fxSynth = {\r\n\t\tSynthDef.new(\\masterFX, {\r\n\t\t\targ input, pos = 0, delayTime = 0, decayTime = 0, level = 1;\r\n\t\t\tvar in, snd, fb, delay, left, right, locIn;\r\n\r\n\t\t\tin = In.ar(input,1);\r\n\t\t\tlocIn = LocalIn.ar(1, 0);\r\n\t\t\tsnd = locIn + in;\r\n\t\t\tfb = DelayC.ar(snd*decayTime, 1, delayTime);\r\n\t\t\tLocalOut.ar( fb );\r\n\t\t\tsnd = Balance2.ar(snd, snd, pos, level);\r\n\t\t\tOut.ar(0, snd);\r\n\r\n\t\t}).add;\r\n\r\n\t\tfx = Synth.new(\\masterFX, [\\input, ~out]);\r\n\t};\r\n\t*/\r\n\r\n\tvar point;\r\n\tvar points;\r\n\tvar l = String.new;\r\n\tvar ll = String.new;\r\n\tvar z = ();\r\n\tvar playDownFunc = {|note|\r\n\t\tll.postln;\r\n\t\tz[note] = Array.newClear(l.size);\r\n\t\tl.do{|item,i|\r\n\t\t\tswitch(point[i].size,\r\n\t\t\t\t1, {\r\n\t\t\t\t\tz[note][i] = Synth(item.asSymbol, [\r\n\t\t\t\t\t\t\\freq, freqBox.value,\r\n\t\t\t\t\t\t\\freqMul0, harmBox[b.find([point[i]])].value,\r\n\t\t\t\t\t\t\\fine0, fineBox[b.find([point[i]])].value,\r\n\t\t\t\t\t\t\\phase0, phaseBox[b.find([point[i]])].value,\r\n\t\t\t\t\t\t\\mul0, ampBox[b.find([point[i]])].value,\r\n\t\t\t\t\t\t\\env0, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([point[i]])].value, sustainBox[b.find([point[i]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([point[i]])].value, decayBox[b.find([point[i]])].value, releaseBox[b.find([point[i]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([point[i]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\pitchEnv0, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([point[i]])].value/100*freqBox.value,pitchSustain[b.find([point[i]])].value/100*freqBox.value,pitchEnd[b.find([point[i]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([point[i]])].value,pitchRelease[b.find([point[i]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\lfoEnv, Env([lfoStart.value,lfoSustain.value,lfoRelease.value],[lfoAttack.value,lfoRelease.value], curveBox[4].value, 1),\r\n\t\t\t\t\t\t\\lfoIndex, lfoMenu.value,\r\n\t\t\t\t\t\t\\filterEnv, Env([filterStart.value/100*freqBox.value+freqBox.value,filterSustain.value/100*freqBox.value+freqBox.value,filterEnd.value/100*freqBox.value+freqBox.value],[filterAttack.value,filterRelease.value], curveBox[5].value, 1),\r\n\t\t\t\t\t\t\\filterIndex, filterMenu.value,\r\n\t\t\t\t\t\t\\lfoPhase, lfoPhase.value,\r\n\t\t\t\t\t\t\\rq, rq.value,\r\n\t\t\t\t\t\t\\out, ~out\r\n\t\t\t\t\t]);\r\n\t\t\t\t},\r\n\t\t\t\t3, {\r\n\t\t\t\t\tpoints = point[i].split($*);\r\n\t\t\t\t\tz[note][i] = Synth(item.asSymbol, [\r\n\t\t\t\t\t\t\\freq, freqBox.value,\r\n\t\t\t\t\t\t\\freqMul0, harmBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\freqMul1, harmBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\fine0, fineBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\fine1, fineBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\phase0, phaseBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\phase1, phaseBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\mul0, ampBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\mul1, ampBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\env0, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[0]])].value, sustainBox[b.find([points[0]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[0]])].value, decayBox[b.find([points[0]])].value, releaseBox[b.find([points[0]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env1, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[1]])].value, sustainBox[b.find([points[1]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[1]])].value, decayBox[b.find([points[1]])].value, releaseBox[b.find([points[1]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\pitchEnv0, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[0]])].value/100*freqBox.value,pitchSustain[b.find([points[0]])].value/100*freqBox.value,pitchEnd[b.find([points[0]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[0]])].value,pitchRelease[b.find([points[0]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv1, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[1]])].value/100*freqBox.value,pitchSustain[b.find([points[1]])].value/100*freqBox.value,pitchEnd[b.find([points[1]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[1]])].value,pitchRelease[b.find([points[1]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\lfoEnv, Env([lfoStart.value,lfoSustain.value,lfoRelease.value],[lfoAttack.value,lfoRelease.value], curveBox[4].value, 1),\r\n\t\t\t\t\t\t\\lfoIndex, lfoMenu.value,\r\n\t\t\t\t\t\t\\filterEnv, Env([filterStart.value+freqBox.value,filterSustain.value+freqBox.value,filterEnd.value+freqBox.value],[filterAttack.value,filterRelease.value], curveBox[5].value, 1),\r\n\t\t\t\t\t\t\\filterIndex, filterMenu.value,\r\n\t\t\t\t\t\t\\lfoPhase, lfoPhase.value,\r\n\t\t\t\t\t\t\\rq, rq.value,\r\n\t\t\t\t\t\t\\out, ~out\r\n\t\t\t\t\t]);\r\n\t\t\t\t},\r\n\t\t\t\t5, {\r\n\t\t\t\t\tpoints = point[i].split($*);\r\n\t\t\t\t\tz[note][i] = Synth(item.asSymbol, [\r\n\t\t\t\t\t\t\\freq, freqBox.value,\r\n\t\t\t\t\t\t\\freqMul0, harmBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\freqMul1, harmBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\freqMul2, harmBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\fine0, fineBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\fine1, fineBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\fine2, fineBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\phase0, phaseBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\phase1, phaseBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\phase2, phaseBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\mul0, ampBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\mul1, ampBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\mul2, ampBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\env0, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[0]])].value, sustainBox[b.find([points[0]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[0]])].value, decayBox[b.find([points[0]])].value, releaseBox[b.find([points[0]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env1,  Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[1]])].value, sustainBox[b.find([points[1]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[1]])].value, decayBox[b.find([points[1]])].value, releaseBox[b.find([points[1]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env2,  Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[2]])].value, sustainBox[b.find([points[2]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[2]])].value, decayBox[b.find([points[2]])].value, releaseBox[b.find([points[2]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\pitchEnv0, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[0]])].value/100*freqBox.value,pitchSustain[b.find([points[0]])].value/100*freqBox.value,pitchEnd[b.find([points[0]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[0]])].value,pitchRelease[b.find([points[0]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv1, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[1]])].value/100*freqBox.value,pitchSustain[b.find([points[1]])].value/100*freqBox.value,pitchEnd[b.find([points[1]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[1]])].value,pitchRelease[b.find([points[1]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv2, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[2]])].value/100*freqBox.value,pitchSustain[b.find([points[2]])].value/100*freqBox.value,pitchEnd[b.find([points[2]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[2]])].value,pitchRelease[b.find([points[2]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\lfoEnv, Env([lfoStart.value,lfoSustain.value,lfoRelease.value],[lfoAttack.value,lfoRelease.value], curveBox[4].value, 1),\r\n\t\t\t\t\t\t\\lfoIndex, lfoMenu.value,\r\n\t\t\t\t\t\t\\filterEnv, Env([filterStart.value+freqBox.value,filterSustain.value+freqBox.value,filterEnd.value+freqBox.value],[filterAttack.value,filterRelease.value], curveBox[5].value, 1),\r\n\t\t\t\t\t\t\\filterIndex, filterMenu.value,\r\n\t\t\t\t\t\t\\lfoPhase, lfoPhase.value,\r\n\t\t\t\t\t\t\\rq, rq.value,\r\n\t\t\t\t\t\t\\out, ~out\r\n\t\t\t\t\t]);\r\n\t\t\t\t},\r\n\t\t\t\t7, {\r\n\t\t\t\t\tpoints = point[i].split($*);\r\n\t\t\t\t\tz[note][i] = Synth(item.asSymbol, [\r\n\t\t\t\t\t\t\\freq, freqBox.value,\r\n\t\t\t\t\t\t\\freqMul0, harmBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\freqMul1, harmBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\freqMul2, harmBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\freqMul3, harmBox[b.find([points[3]])].value,\r\n\t\t\t\t\t\t\\fine0, fineBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\fine1, fineBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\fine2, fineBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\fine3, fineBox[b.find([points[3]])].value,\r\n\t\t\t\t\t\t\\phase0, phaseBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\phase1, phaseBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\phase2, phaseBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\phase3, phaseBox[b.find([points[3]])].value,\r\n\t\t\t\t\t\t\\mul0, ampBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\\mul1, ampBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\\mul2, ampBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\\mul3, ampBox[b.find([points[3]])].value,\r\n\t\t\t\t\t\t\\env0, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[0]])].value, sustainBox[b.find([points[0]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[0]])].value, decayBox[b.find([points[0]])].value, releaseBox[b.find([points[0]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[0]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env1,  Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[1]])].value, sustainBox[b.find([points[1]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[1]])].value, decayBox[b.find([points[1]])].value, releaseBox[b.find([points[1]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[1]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env2,  Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[2]])].value, sustainBox[b.find([points[2]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[2]])].value, decayBox[b.find([points[2]])].value, releaseBox[b.find([points[2]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[2]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\env3, Env(\r\n\t\t\t\t\t\t\t[0,peakBox[b.find([points[3]])].value, sustainBox[b.find([points[3]])].value, 0],\r\n\t\t\t\t\t\t\t[attackBox[b.find([points[3]])].value, decayBox[b.find([points[3]])].value, releaseBox[b.find([points[3]])].value],\r\n\t\t\t\t\t\t\tcurveBox[b.find([points[3]])].value,\r\n\t\t\t\t\t\t\treleaseNode:2\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\\pitchEnv0, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[0]])].value/100*freqBox.value,pitchSustain[b.find([points[0]])].value/100*freqBox.value,pitchEnd[b.find([points[0]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[0]])].value,pitchRelease[b.find([points[0]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv1, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[1]])].value/100*freqBox.value,pitchSustain[b.find([points[1]])].value/100*freqBox.value,pitchEnd[b.find([points[1]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[1]])].value,pitchRelease[b.find([points[1]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv2, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[2]])].value/100*freqBox.value,pitchSustain[b.find([points[2]])].value/100*freqBox.value,pitchEnd[b.find([points[2]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[2]])].value,pitchRelease[b.find([points[2]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\pitchEnv3, Env(\r\n\t\t\t\t\t\t\t[pitchStart[b.find([points[3]])].value/100*freqBox.value,pitchSustain[b.find([points[3]])].value/100*freqBox.value,pitchEnd[b.find([points[3]])].value/100*freqBox.value],\r\n\t\t\t\t\t\t\t[pitchAttack[b.find([points[3]])].value,pitchRelease[b.find([points[3]])].value], releaseNode: 1),\r\n\t\t\t\t\t\t\\lfoEnv, Env([lfoStart.value,lfoSustain.value,lfoRelease.value],[lfoAttack.value,lfoRelease.value], curveBox[4].value, 1),\r\n\t\t\t\t\t\t\\lfoIndex, lfoMenu.value,\r\n\t\t\t\t\t\t\\filterEnv, Env([filterStart.value+freqBox.value,filterSustain.value+freqBox.value,filterEnd.value+freqBox.value],[filterAttack.value,filterRelease.value], curveBox[5].value, 1),\r\n\t\t\t\t\t\t\\filterIndex, filterMenu.value,\r\n\t\t\t\t\t\t\\lfoPhase, lfoPhase.value,\r\n\t\t\t\t\t\t\\rq, rq.value,\r\n\t\t\t\t\t\t\\out, ~out\r\n\t\t\t\t\t]);\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t};\r\n\t};\r\n\tvar playUpFunc = {|note|\r\n\t\tz.removeAt(note).do{|synth| synth.release};\r\n\t};\r\n\tServer.default.sync;\r\n\t~out = Bus.audio(s,1);\r\n\r\n\r\n\tmodField.action_({|s|\r\n\t\tl = String.new;\r\n\t\tpoint = String.new;\r\n\t\ts.value.do{|item, i|\r\n\r\n\t\t\tswitch(item.asString,\r\n\t\t\t\t\"a\", {\r\n\t\t\t\t\tswitch(waveformMenu[0].value,\r\n\t\t\t\t\t\t0, {l = l ++ \"SinOsc\"},\r\n\t\t\t\t\t\t1, {l = l ++ \"LFTri\"},\r\n\t\t\t\t\t\t2, {l = l ++ \"LFSaw\"},\r\n\t\t\t\t\t\t3, {l = l ++ \"WhiteNoise\"}\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\t\"b\", {\r\n\t\t\t\t\tswitch(waveformMenu[1].value,\r\n\t\t\t\t\t\t0, {l = l ++ \"SinOsc\"},\r\n\t\t\t\t\t\t1, {l = l ++ \"LFTri\"},\r\n\t\t\t\t\t\t2, {l = l ++ \"LFSaw\"},\r\n\t\t\t\t\t\t3, {l = l ++ \"WhiteNoise\"}\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\t\"c\", {\r\n\t\t\t\t\tswitch(waveformMenu[2].value,\r\n\t\t\t\t\t\t0, {l = l ++ \"SinOsc\"},\r\n\t\t\t\t\t\t1, {l = l ++ \"LFTri\"},\r\n\t\t\t\t\t\t2, {l = l ++ \"LFSaw\"},\r\n\t\t\t\t\t\t3, {l = l ++ \"WhiteNoise\"}\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\t\"d\", {\r\n\t\t\t\t\tswitch(waveformMenu[3].value,\r\n\t\t\t\t\t\t0, {l = l ++ \"SinOsc\"},\r\n\t\t\t\t\t\t1, {l = l ++ \"LFTri\"},\r\n\t\t\t\t\t\t2, {l = l ++ \"LFSaw\"},\r\n\t\t\t\t\t\t3, {l = l ++ \"WhiteNoise\"}\r\n\t\t\t\t\t);\r\n\t\t\t\t},\r\n\t\t\t\t\"+\", {l = l ++ \"+\"},\r\n\t\t\t\t\"*\", {l = l ++ \"*\"}\r\n\t\t\t);\r\n\t\t};\r\n\t\tll = l.split($+);\r\n\t\tl = l.replace(\"*\", \"\").split($+);\r\n\t\t[\"SynthName/item/variableName: \"++ l].postln;\r\n\r\n\t\tpoint = s.value.split($+);\r\n\t\t[\"point: \"++ point].postln;\r\n\t\tmodText.string = s.value;\r\n\r\n\t\tsynthBuildFunc.value;\r\n\r\n\r\n\t});\r\n\tServer.default.sync;\r\n\toscButton.value = 1;\r\n\r\n\t//oscEnv Interaction\r\n\tfor(0,3,{|i|\r\n\t\tharmBox[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\tfineBox[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\tampBox[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\tphaseBox[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\twaveformMenu[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\toscText[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\toscShow1[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t\toscShow2[i].mouseDownAction_({aEnv.layout.index_(i);});\r\n\t});\r\n\r\n\r\n\tplay.mouseDownAction_(playDownFunc).mouseUpAction_(playUpFunc);\r\n\r\n\tw.layout_(GridLayout.rows(\r\n\t\t[modus, columns: 7],\r\n\t\t[[stackView, columns: 7]],\r\n\t\t[play,info.last,freqBox, StaticText().string_(\"pan\").stringColor_(stringColor), panner, StaticText().string_(\"level\").stringColor_(stringColor), level ]\r\n\t));\r\n\tw.background_(Color.gray(0.2,0.9));\r\n\tw.front;\r\n\tmodField.valueAction_(modField.value);\r\n\tfxSynth.value;\r\n\tServer.default.sync;\r\n\tdecayTime.valueAction = 0.5;\r\n\tdecayTime.valueAction = decayTime.value;\r\n\tw.onClose_({fx.free});\r\n\r\n\r\n\r\n///////KEYS/MIDI\r\n\t// looks like I'll need to change some of this to have it play how I want it to.\r\n\tkeyDict.putPairs([\\z, true, \\x, true, \\c, true, \\v, true, \\b, true, \\n, true, \\m, true, \\a, true, \\s, true, \\s, true, \\d, true, \\f, true, \\g, true, \\h, true, \\j, true, \\k, true, \\l, true, \\q, true, \\w, true, \\e, true, \\r, true, \\t, true, \\y, true, \\u, true, \\i, true, \\o, true, \\p, true, \\1, true, \\2, true, \\3, true, \\4, true, \\5, true, \\6, true, \\7, true, \\8, true, \\9, true, \\0, true]);\r\n\r\n\tw.view.keyDownAction_({|view, char|\r\n\r\n\r\n\t\tswitch(char,\r\n\t\t\t$z, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-12).midicps; playDownFunc.(1); keyDict.putPairs([\\z, false]);}, {nil})},\r\n\t\t\t$x, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-11).midicps; playDownFunc.(2); keyDict.putPairs([\\x, false]);}, {nil})},\r\n\t\t\t$c, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-10).midicps; playDownFunc.(3); keyDict.putPairs([\\c, false]);}, {nil})},\r\n\t\t\t$v, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-9).midicps; playDownFunc.(4); keyDict.putPairs([\\v, false]);}, {nil})},\r\n\t\t\t$b, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-8).midicps; playDownFunc.(5); keyDict.putPairs([\\b, false]);}, {nil})},\r\n\t\t\t$n, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-7).midicps; playDownFunc.(6); keyDict.putPairs([\\n, false]);}, {nil})},\r\n\t\t\t$a, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-7).midicps; playDownFunc.(7); keyDict.putPairs([\\a, false]);}, {nil})},\r\n\t\t\t$m, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-6).midicps; playDownFunc.(8); keyDict.putPairs([\\m, false]);}, {nil})},\r\n\t\t\t$s, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-6).midicps; playDownFunc.(9); keyDict.putPairs([\\s, false]);}, {nil})},\r\n\t\t\t$d, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-5).midicps; playDownFunc.(10); keyDict.putPairs([\\d, false]);}, {nil})},\r\n\t\t\t$f, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-4).midicps; playDownFunc.(11); keyDict.putPairs([\\f, false]);}, {nil})},\r\n\t\t\t$g, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-3).midicps; playDownFunc.(12); keyDict.putPairs([\\g, false]);}, {nil})},\r\n\t\t\t$h, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-2).midicps; playDownFunc.(13); keyDict.putPairs([\\h, false]);}, {nil})},\r\n\t\t\t$q, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-2).midicps; playDownFunc.(14); keyDict.putPairs([\\q, false]);}, {nil})},\r\n\t\t\t$j, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-1).midicps; playDownFunc.(15); keyDict.putPairs([\\j, false]);}, {nil})},\r\n\t\t\t$w, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct-1).midicps; playDownFunc.(16); keyDict.putPairs([\\w, false]);}, {nil})},\r\n\t\t\t$k, { if(keyDict.at( char.asSymbol), {freqBox.value = oct.midicps; playDownFunc.(17); keyDict.putPairs([\\k, false]);}, {nil})},\r\n\t\t\t$e, { if(keyDict.at( char.asSymbol), {freqBox.value = oct.midicps; playDownFunc.(18); keyDict.putPairs([\\e, false]);}, {nil})},\r\n\t\t\t$l, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+1).midicps; playDownFunc.(19); keyDict.putPairs([\\l, false]);}, {nil})},\r\n\t\t\t$r, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+1).midicps; playDownFunc.(20); keyDict.putPairs([\\r, false]);}, {nil})},\r\n\t\t\t$t, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+2).midicps; playDownFunc.(21); keyDict.putPairs([\\t, false]);}, {nil})},\r\n\t\t\t$y, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+3).midicps; playDownFunc.(22); keyDict.putPairs([\\y, false]);}, {nil})},\r\n\t\t\t$1, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+3).midicps; playDownFunc.(23); keyDict.putPairs([\\1, false]);}, {nil})},\r\n\t\t\t$u, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+4).midicps; playDownFunc.(24); keyDict.putPairs([\\u, false]);}, {nil})},\r\n\t\t\t$2, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+4).midicps; playDownFunc.(25); keyDict.putPairs([\\2, false]);}, {nil})},\r\n\t\t\t$i, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+5).midicps; playDownFunc.(26); keyDict.putPairs([\\i, false]);}, {nil})},\r\n\t\t\t$3, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+5).midicps; playDownFunc.(27); keyDict.putPairs([\\3, false]);}, {nil})},\r\n\t\t\t$o, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+6).midicps; playDownFunc.(28); keyDict.putPairs([\\o, false]);}, {nil})},\r\n\t\t\t$4, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+6).midicps; playDownFunc.(29); keyDict.putPairs([\\4, false]);}, {nil})},\r\n\t\t\t$p, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+7).midicps; playDownFunc.(30); keyDict.putPairs([\\p, false]);}, {nil})},\r\n\t\t\t$5, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+7).midicps; playDownFunc.(31); keyDict.putPairs([\\5, false]);}, {nil})},\r\n\t\t\t$6, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+8).midicps; playDownFunc.(32); keyDict.putPairs([\\6, false]);}, {nil})},\r\n\t\t\t$7, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+9).midicps; playDownFunc.(33); keyDict.putPairs([\\7, false]);}, {nil})},\r\n\t\t\t$8, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+10).midicps; playDownFunc.(34); keyDict.putPairs([\\8, false]);}, {nil})},\r\n\t\t\t$9, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+11).midicps; playDownFunc.(35); keyDict.putPairs([\\9, false]);}, {nil})},\r\n\t\t\t$0, { if(keyDict.at( char.asSymbol), {freqBox.value = (oct+12).midicps; playDownFunc.(36); keyDict.putPairs([\\0, false]);}, {nil})},\r\n\t\t\t$,, {oct = oct - 12},\r\n\t\t\t$., {oct = oct + 12}\r\n\r\n\t\t);\r\n\t\tchar.asString.postln;\r\n\t});\r\n\tw.view.keyUpAction_({|view, char|\r\n\t\tswitch(char,\r\n\t\t\t$z, {playUpFunc.(1); keyDict.putPairs([\\z, true]);},\r\n\t\t\t$x, {playUpFunc.(2); keyDict.putPairs([\\x, true]);},\r\n\t\t\t$c, {playUpFunc.(3); keyDict.putPairs([\\c, true]);},\r\n\t\t\t$v, {playUpFunc.(4); keyDict.putPairs([\\v, true])},\r\n\t\t\t$b, {playUpFunc.(5); keyDict.putPairs([\\b, true])},\r\n\t\t\t$n, {playUpFunc.(6); keyDict.putPairs([\\n, true])},\r\n\t\t\t$a, {playUpFunc.(7); keyDict.putPairs([\\a, true])},\r\n\t\t\t$m, {playUpFunc.(8); keyDict.putPairs([\\m, true])},\r\n\t\t\t$s, {playUpFunc.(9); keyDict.putPairs([\\s, true])},\r\n\t\t\t$d, {playUpFunc.(10); keyDict.putPairs([\\d, true])},\r\n\t\t\t$f, {playUpFunc.(11); keyDict.putPairs([\\f, true])},\r\n\t\t\t$g, {playUpFunc.(12); keyDict.putPairs([\\g, true])},\r\n\t\t\t$h, {playUpFunc.(13); keyDict.putPairs([\\h, true])},\r\n\t\t\t$q, {playUpFunc.(14); keyDict.putPairs([\\q, true])},\r\n\t\t\t$j, {playUpFunc.(15); keyDict.putPairs([\\j, true])},\r\n\t\t\t$w, {playUpFunc.(16); keyDict.putPairs([\\w, true])},\r\n\t\t\t$k, {playUpFunc.(17); keyDict.putPairs([\\k, true])},\r\n\t\t\t$e, {playUpFunc.(18); keyDict.putPairs([\\e, true])},\r\n\t\t\t$l, {playUpFunc.(19); keyDict.putPairs([\\l, true])},\r\n\t\t\t$r, {playUpFunc.(20); keyDict.putPairs([\\r, true])},\r\n\t\t\t$t, {playUpFunc.(21); keyDict.putPairs([\\t, true])},\r\n\t\t\t$y, {playUpFunc.(22); keyDict.putPairs([\\y, true])},\r\n\t\t\t$1, {playUpFunc.(23); keyDict.putPairs([\\1, true])},\r\n\t\t\t$u, {playUpFunc.(24); keyDict.putPairs([\\u, true])},\r\n\t\t\t$2, {playUpFunc.(25); keyDict.putPairs([\\2, true])},\r\n\t\t\t$i, {playUpFunc.(26); keyDict.putPairs([\\i, true])},\r\n\t\t\t$3, {playUpFunc.(27); keyDict.putPairs([\\3, true])},\r\n\t\t\t$o, {playUpFunc.(28); keyDict.putPairs([\\o, true])},\r\n\t\t\t$4, {playUpFunc.(29); keyDict.putPairs([\\4, true])},\r\n\t\t\t$p, {playUpFunc.(30); keyDict.putPairs([\\p, true])},\r\n\t\t\t$5, {playUpFunc.(31); keyDict.putPairs([\\5, true])},\r\n\t\t\t$6, {playUpFunc.(32); keyDict.putPairs([\\6, true])},\r\n\t\t\t$7, {playUpFunc.(33); keyDict.putPairs([\\7, true])},\r\n\t\t\t$8, {playUpFunc.(34); keyDict.putPairs([\\8, true])},\r\n\t\t\t$9, {playUpFunc.(35); keyDict.putPairs([\\9, true])},\r\n\t\t\t$0, {playUpFunc.(36); keyDict.putPairs([\\0, true])},\r\n\t\t);\r\n\t});\r\n\r\n\tMIDIdef.noteOn(\\on, { |vel, note| { freqBox.value = note.midicps; playDownFunc.(note); }.defer });\r\n\tMIDIdef.noteOff(\\off, { |vel, note|  { playUpFunc.(note); }.defer });\r\n\r\n});\r\n);",
   "labels" : [
      "filter",
      "additive synthesis",
      "lfo",
      "computer keyboard",
      "isomorphic layout"
   ]
}
