Advertisement
degu234

ChordOrgan Synthvoicegate

Sep 10th, 2021
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 21.54 KB | None | 0 0
  1. /* custom firmware for the chord organ module from music thing modular designed and created by Tom Whitwell
  2.     aviable at thonk
  3.     with alot of help from "Wolle Wer". Thank you once again at this point
  4.     this Firmware trys to be several synthvoices in one with nice audio-modulation and FX abilty.
  5.     in the system are 4 waveformgenrators, 2 filters in series, wavefolder, bitcrusher and delay.
  6.     the first filter is controled by the signal coming from stationCV Jack, the second filter is controlled
  7.     by the stationknob aviable at page 0. You may control the first filters resonance with startknob also on page 0
  8.     stationKnob = A9
  9.     stationCV = A8
  10.     startKnob = A7
  11.     startCV = A6
  12.     tasterButton = Pin 8
  13.     triggerCV = Pin 9
  14.     Output = dac1
  15.  
  16.     startCV changes Pitch within a range of 3.3V equal 40 Notes, notes are quantized
  17.     stationCV changes filter1.frequency i.E. external envelope
  18.     with tasterButton you can switch thru different pages.
  19.     Each Page has the two knobs Station- and startKnob to change different parameters
  20.  
  21.     page (stationKnob, startKnob)
  22.     initial page 0 (filter2.frequency, filter1.resonance)
  23.     page 1 (mixer1.gain(Note1), (mixer1.gain(note2,3,4)
  24.     page 2 (chord selection, waveform1,2,3,4.selection)
  25.     page 3 (wavefolder1, bitcrusher1)
  26.     page 4 (delay1.time <200ms, delay1.feedback)
  27.  
  28.   //todo:
  29.   //EnvelopeGenerator with trigger in that actually sends a control value (dc2) to the filter (dc2 * 8184)
  30.   //Envelopegenerator Attack/Release control on a new page controlled by stationKnob/startKnob
  31.   //
  32.   //
  33. */
  34.  
  35. #include <synth_waveform.h>
  36.  
  37. #include <Audio.h>
  38. #include <Wire.h>
  39. #include <SPI.h>
  40. #include <SD.h>
  41. #include <SerialFlash.h>
  42.  
  43. // GUItool: begin automatically generated code
  44. AudioSynthWaveform       waveform3;      //xy=195.80627059936523,430.00000762939453
  45. AudioSynthWaveform       waveform1;      //xy=198.80627059936523,334.00000762939453
  46. AudioSynthWaveform       waveform2;      //xy=199.80627059936523,383.00000762939453
  47. AudioSynthWaveform       waveform4;      //xy=208.80627059936523,480.00000762939453
  48. AudioSynthWaveformDc     dc2;            //xy=319.80625915527344,548.8250045776367
  49. AudioMixer4              mixer1;         //xy=358.80627059936523,371.00000762939453
  50. AudioEffectEnvelope      envelope1;      //xy=447,485
  51. AudioFilterStateVariable filter1;        //xy=511.8062438964844,386.9999885559082
  52. AudioSynthWaveformDc     dc1;            //xy=549.8062744140625,614.0000114440918
  53. AudioMixer4              mixer2;         //xy=648.8062744140625,397.0000114440918
  54. AudioFilterStateVariable filter2;        //xy=659.8062705993652,278.00000762939453
  55. AudioEffectWaveFolder    wavefolder1;    //xy=815.8062744140625,460.0000114440918
  56. AudioEffectBitcrusher    bitcrusher1;    //xy=846.8062744140625,350.0000114440918
  57. AudioEffectDelay         delay1;         //xy=1016.8062744140625,601.0000114440918
  58. AudioMixer4              mixer3;         //xy=1020.8062744140625,418.0000114440918
  59. AudioFilterStateVariable filter3;        //xy=1020.8062744140625,493.0000114440918
  60. AudioMixer4              mixer5;         //xy=1186.8062744140625,413.00000762939453
  61. AudioOutputAnalog        dac1;           //xy=1322.8063125610352,418.9999885559082
  62. AudioConnection          patchCord1(waveform3, 0, mixer1, 2);
  63. AudioConnection          patchCord2(waveform1, 0, mixer1, 0);
  64. AudioConnection          patchCord3(waveform2, 0, mixer1, 1);
  65. AudioConnection          patchCord4(waveform4, 0, mixer1, 3);
  66. AudioConnection          patchCord5(dc2, envelope1);
  67. AudioConnection          patchCord6(mixer1, 0, filter1, 0);
  68. AudioConnection          patchCord7(envelope1, 0, filter1, 1);
  69. AudioConnection          patchCord8(filter1, 0, filter2, 0);
  70. AudioConnection          patchCord9(dc1, 0, wavefolder1, 1);
  71. AudioConnection          patchCord10(mixer2, 0, wavefolder1, 0);
  72. AudioConnection          patchCord11(filter2, 0, mixer2, 0);
  73. AudioConnection          patchCord12(wavefolder1, bitcrusher1);
  74. AudioConnection          patchCord13(bitcrusher1, 0, mixer3, 0);
  75. AudioConnection          patchCord14(delay1, 0, filter3, 0);
  76. AudioConnection          patchCord15(mixer3, delay1);
  77. AudioConnection          patchCord16(mixer3, 0, mixer5, 0);
  78. AudioConnection          patchCord17(filter3, 2, mixer3, 1);
  79. AudioConnection          patchCord18(mixer5, dac1);
  80. AudioControlSGTL5000     sgtl5000_1;     //xy=896.8062744140625,740.0000114440918
  81. // GUItool: end automatically generated code
  82.  
  83.  
  84. //Constants
  85. const int tasterPin = 8;     //taster at Pin 8
  86. const int triggerPin = 9;    //Jack for Gate at Pin 9
  87.  
  88. const int L1Pin = 3;       // LED1 at Pin 3
  89. const int L2Pin = 4;      // LED2 at Pin 4
  90. const int L3Pin = 5;      // LED3 at Pin 5
  91. const int L4Pin = 6;      // LED4 at Pin 6
  92. const int L5Pin = 11;     // LED5 at Pin 11
  93.  
  94. //Variables
  95. int mode = 0;                // Variable for case switching
  96. int DetectionMode = 0;       //detection for stationKnob hook up
  97. int DetectionMode2 = 0;       //detection for startKnob hook up
  98. int tasterState = 0;         // Variable to save tasterstate
  99. int triggerState = 0;     // Variable to save triggerstate
  100.  
  101. float Note2[8] = {1.25992, 1.18920, 1.25992, 1.33484, 1.33484, 1.25992, 1.33484, 1.33484};  //{4, 3, 4, 3, 5, 4, 3, 3}Frequency proportion to 2nd note
  102. float Note3[8] = {1.49830, 1.49830, 1.49830, 1.49830, 1.49830, 1.49830, 1.49830, 1.41421};  //{7, 7, 7, 7, 7, 7, 7, 6};Frequency proportion to 3rd note
  103. float Note4[8] = {2.00000, 2.00000, 1.88775, 1.78179, 1.88775, 1.58739, 1.58739, 2.00000};  //{12, 12, 11, 10, 12, 8, 8, 12};Frequency proportion to 4th note
  104. int noteArray;
  105. float Hertz[61] = {65.4064, 69.957, 73.41619, 77.78175, 82.40689, 87.30706, 92.49861, 97.99886, 103.8262, 110.0000, 116.5409, 123.4708,
  106.                    130.8128, 138.5913, 146.8324, 155.5635, 164.8138, 174.6141, 184.9972, 195.9977, 207.6523, 220.0000, 233.0819, 246.9417,
  107.                    261.6256, 277.1826, 293.6648, 311.1270, 329.6276, 349.2282, 369.9944, 391.9954, 415.3047, 440.0000, 466.1638, 493.8833,
  108.                    523.2511, 554.3653, 587.3295, 622.2540, 659.2551, 698.4565, 739.9888, 783.9909, 830.6094, 880.0000, 932.3275, 987.7666,
  109.                    1046.502, 1108.731, 1174.659, 1244.508, 1318.510, 1396.913, 1479.978, 1567.982, 1661.219, 1760.000, 1864.655, 1975.533, 2093.005
  110.                   };
  111.  
  112. //variables to handle each´s page last knob position
  113. int filterCutoff = 512;
  114. int resoNance = 0;
  115. int volume1 = 1023;
  116. int volume234 = 1023;
  117. int chordSelect = 0;
  118. int wfSelect = 439;
  119. int waveFolder = 307;
  120. int bitCrusher = 1023;
  121. int delayTime = 0;
  122. int feedBack = 0;
  123. int attAck = 5;
  124. int reLease = 200;
  125.  
  126. void setup() {
  127.   Serial.begin(19200); // USB is always 12 or 480 Mbit/sec
  128.   //setting up the audio components
  129.   //===========================================================================
  130.   //analogReadResolution(12);
  131.   AudioMemory(200);
  132.  
  133.   waveform1.begin(WAVEFORM_SAWTOOTH);
  134.   waveform1.amplitude(1);
  135.   waveform1.frequency(65.41);
  136.   waveform1.pulseWidth(0.15);
  137.  
  138.   waveform2.begin(WAVEFORM_SAWTOOTH);
  139.   waveform2.amplitude(1);
  140.   waveform2.frequency(65.41);
  141.   waveform2.pulseWidth(0.15);
  142.  
  143.   waveform3.begin(WAVEFORM_SAWTOOTH);
  144.   waveform3.amplitude(1);
  145.   waveform3.frequency(65.41);
  146.   waveform3.pulseWidth(0.15);
  147.  
  148.   waveform4.begin(WAVEFORM_SAWTOOTH);
  149.   waveform4.amplitude(1);
  150.   waveform4.frequency(65.41);
  151.   waveform4.pulseWidth(0.15);
  152.  
  153.   //mixer1 to controll Waveform1 with stationKnob; Waveform2-4 with startKnob on page 1
  154.   mixer1.gain(0, 0.25);
  155.   mixer1.gain(1, 0.25);
  156.   mixer1.gain(2, 0.25);
  157.   mixer1.gain(3, 0.25);
  158.  
  159.   envelope1.delay(0);
  160.   envelope1.attack(200);
  161.   envelope1.hold(0);
  162.   envelope1.decay(500);
  163.   envelope1.sustain(0.5);
  164.   envelope1.release(500);
  165.  
  166.   dc2.amplitude(1);
  167.  
  168.   //filter1 is controlled by the stationCV input
  169.   filter1.frequency(110);                                                  //set initial Filter1 freq to 16000Hz
  170.   filter1.resonance(0);                                                      //set Resonance to 0
  171.   filter1.octaveControl(5);
  172.  
  173.   //filter2 is controlled by the stationKnob on page 0
  174.   filter2.frequency(16000);                                                  //set initial Filter2 freq to 16000Hz
  175.   filter2.resonance(0);                                                      //set Resonance to 0
  176.  
  177.   //mixer2 is just there, no need for it actually
  178.   mixer2.gain(0, 1);                                                         //set Mixer2(Channel, Gain) (0-3, 0-1)
  179.   mixer2.gain(1, 1);
  180.  
  181.   //dc1 for wavefolder input controlled by stationKnob on page 3
  182.   dc1.amplitude(0.05);                                                       //set dc1 for Wavefolder Input
  183.  
  184.   //bitcrusher1 controlled by startKnob on page 3
  185.   bitcrusher1.bits(16);
  186.   bitcrusher1.sampleRate(44100);
  187.  
  188.   //delay1 time controlled by stationKnob; feedback controlled by startKnob on page 4
  189.   delay1.delay(0, 3);                                                        //set Delay(OutChannel, saved Samples) (0-7, 3-449*) *maximum
  190.  
  191.   //filter3 HighPassfilter to get rid of the muddy sound in feedbackloop
  192.   filter3.frequency(200);                                                   //set initial Filter3 freq to 16000Hz
  193.   filter3.resonance(0);                                                      //set Resonance to 0
  194.  
  195.   //mixer3 for feedback controlled by startKnob on page 4
  196.   mixer3.gain(0, 1);                                                         //setze Mixer2(Kanal, Gain) (0-3, 0-1)
  197.   mixer3.gain(1, 0);
  198.  
  199.   //mixer4.gain(1, 0);
  200.   //mixer4.gain(0, 0);
  201.  
  202.   //mixer5 again just a mixer to pass audio thru
  203.   mixer5.gain(0, 0.5);
  204.   //mixer5.gain(1, 0.5);
  205.  
  206.  
  207.   //setting up the audio components DONE!!
  208.   //===========================================================================
  209.  
  210.   //setting up the Pins as In´s n Out´s
  211.   //============================================================================
  212.   pinMode(tasterPin, INPUT);                                                 //taster is input
  213.   pinMode(triggerPin, INPUT);                                             //trigger is input
  214.   pinMode(L1Pin, OUTPUT);                                                    // Set LEDPin as output
  215.   pinMode(L2Pin, OUTPUT);                                                    // Set LEDPin as output
  216.   pinMode(L3Pin, OUTPUT);                                                    // Set LEDPin as output
  217.   pinMode(L4Pin, OUTPUT);                                                    // Set LEDPin as output
  218.   pinMode(L5Pin, OUTPUT);                                                    // Set LEDPin as output
  219.  
  220.  
  221. }
  222.  
  223.  
  224.  
  225.  
  226. void loop() {
  227.   tasterState = digitalRead(tasterPin);                                       //read tasterPin and set tasterState
  228.   triggerState = digitalRead(triggerPin);                                  //read triggerPin and set triggerState
  229.  
  230.   int startCV = analogRead(A8);
  231.   int startKnob = analogRead(A7);                                             //lies Analog7 und setze auf startKnob
  232.   int stationKnob = analogRead(A9);                                           //lies Analog9 und setze auf stationKnob
  233.   int stationCV = analogRead(A6);                                             //lies Analog6 und setze auf stationCV
  234.   int triggerlock;
  235.  
  236.   //1V/Octave works, though only till 3.3V so its a 40 Note Range beginning from C1 65.4064Hz Hertzarray goes to 60, so you could transpose those 40 Notes :)
  237.   //works independently from pageselection
  238.   //PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  239.   int hertzseriell = map(startCV, 0, 1023, 0, 40);
  240.   waveform1.frequency(Hertz[hertzseriell]); //WF1 plays rootnote
  241.   waveform2.frequency(Hertz[hertzseriell] * Note2[noteArray]); //WF2 plays rootnote * Frequencyproportionn from "Note2"-array
  242.   waveform3.frequency(Hertz[hertzseriell] * Note3[noteArray]); //WF3 plays rootnote * Frequencyproportionn from "Note3"-array
  243.   waveform4.frequency(Hertz[hertzseriell] * Note4[noteArray]); //WF4 plays rootnote * Frequencyproportionn from "Note4"-array
  244.   //PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  245.  
  246.   //filter1 freuquency modulation from station CV Jack, independently from pageselection
  247.   //filter1.frequency(map(stationCV, 0, 1023, 0, 8184));
  248.   //mixer3.gain(0, map(stationCV, 0, 511, 0, 1));
  249.  
  250.  
  251.   if (triggerState == HIGH) //when tasterState is High
  252.   {
  253.     if (triggerlock == 0)
  254.     {
  255.       triggerlock == 1; //prevents envelope from being constantly re-triggered while note is held down, you only want the envelope to be triggered once per trigger.
  256.       envelope1.noteOn(); //trigger envelope1 to start envelope
  257.     }
  258.   }
  259.   else
  260.   {
  261.     if (triggerlock == 1)
  262.     {
  263.       triggerlock == 0; // locks the envelope1.noteOff() command from being continuously sent when there is no note, only one note off command is sent.
  264.       envelope1.noteOff(); //end of gate, start release
  265.     }
  266.   }
  267.   digitalWrite(L5Pin, triggerState );
  268.   //TasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTaster
  269.   //=======================================================================================================
  270.   if (tasterState == HIGH)                                                    //when tasterState is High
  271.   {
  272.     mode++;                                                                   //count case mode + 1
  273.     DetectionMode = 0;                                                        //everytime we press the button, ddetectionmode is resetted to 0
  274.     DetectionMode2 = 0;
  275.     delay(200);                                                               //delay zur Entprellung
  276.   }
  277.   //=======================================================================================================
  278.   //TasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTasterTaster
  279.  
  280.  
  281.   digitalWrite(L1Pin, LOW);                                               //Led 1 aus
  282.   digitalWrite(L2Pin, LOW);                                               //Led 2 aus
  283.   digitalWrite(L3Pin, LOW);                                               //Led 3 aus
  284.   digitalWrite(L4Pin, LOW);                                               //Led 4 aus
  285.  
  286.   //begin of page switching and what happens in each page
  287.   //==========================================================================
  288.  
  289.   switch (mode) {
  290.     //00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  291.     case 0: //Filter5 + Resonance
  292.  
  293.       if ((DetectionMode == 0) && (abs(stationKnob - filterCutoff) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  294.         DetectionMode = 1;
  295.       }
  296.       if (DetectionMode == 1) {
  297.         filterCutoff = stationKnob;
  298.       }
  299.       filter2.frequency((float)map(filterCutoff, 0, 1023, 65.41, 8184));       //Filter1 filters cutoff
  300.  
  301.       //--------------------------------------------------------------------------
  302.       if ((DetectionMode2 == 0) && (abs(startKnob - resoNance) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  303.         DetectionMode2 = 1;
  304.       }
  305.       if (DetectionMode2 == 1) {
  306.         resoNance = startKnob;
  307.       }
  308.       filter2.resonance((float)map(resoNance, 0, 1023, 0, 5));                //controls Resonance
  309.       break;
  310.     case 1: //Volume1 + 2,3,4
  311.       //1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
  312.       digitalWrite(L1Pin, HIGH);                                              //Led 1 an
  313.  
  314.       if ((DetectionMode == 0) && (abs(stationKnob - volume1) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  315.         DetectionMode = 1;
  316.       }
  317.       if (DetectionMode == 1) {
  318.         volume1 = stationKnob;
  319.       }
  320.       mixer1.gain(0, ((float)volume1 / 3069));                            //Gain Mixer1 Eingang 0
  321.       //---------------------------------------------------------------------------------------------------------------
  322.       if ((DetectionMode2 == 0) && (abs(startKnob - volume234) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  323.         DetectionMode2 = 1;
  324.       }
  325.       if (DetectionMode2 == 1) {
  326.         volume234 = startKnob;
  327.       }
  328.       mixer1.gain(1, ((float)volume234 / 3069));                              //Gain Mixer1 Eingang 1
  329.       mixer1.gain(2, ((float)volume234 / 3069));                              //Gain Mixer1 Eingang 2
  330.       mixer1.gain(3, ((float)volume234 / 3069));                              //Gain Mixer1 Eingang 3
  331.       break;
  332.  
  333.     //2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
  334.     case 2: //Chordtype + Waveformtype
  335.       digitalWrite(L2Pin, HIGH);                                              //Led 2 an
  336.       if ((DetectionMode == 0) && (abs(stationKnob - chordSelect) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  337.         DetectionMode = 1;
  338.       }
  339.       if (DetectionMode == 1) {
  340.         chordSelect = stationKnob;
  341.       }
  342.       noteArray = map(chordSelect, 0, 1023, 0, 7);                       //stationKnob stores value 0-7 into noteArray
  343.       //----------------------------------------------------------------------------------------------------------------------------------------
  344.       if ((DetectionMode2 == 0) && (abs(startKnob - wfSelect) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  345.         DetectionMode2 = 1;
  346.       }
  347.       if (DetectionMode2 == 1) {
  348.         wfSelect = startKnob;
  349.       }
  350.       waveform1.begin(map(wfSelect, 0, 1023, 0, 12));                        //waveform selection with startKnob
  351.       waveform2.begin(map(wfSelect, 0, 1023, 0, 12));                        //waveform selection with startKnob
  352.       waveform3.begin(map(wfSelect, 0, 1023, 0, 12));                        //waveform selection with startKnob
  353.       waveform4.begin(map(wfSelect, 0, 1023, 0, 12));                        //waveform selection with startKnob
  354.       break;
  355.  
  356.     //3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
  357.     case 3: //wavefolder + bitcrusher
  358.       digitalWrite(L3Pin, HIGH);                                              //Led 3 an
  359.       if ((DetectionMode == 0) && (abs(stationKnob - waveFolder) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  360.         DetectionMode = 1;
  361.       }
  362.       if (DetectionMode == 1) {
  363.         waveFolder = stationKnob;
  364.       }
  365.       dc1.amplitude((float)waveFolder / 1023);                              //dc-value 0-1 for Wavefolder controlled by stationKnob
  366.       //-----------------------------------------------------------------------------------------------------------------------------
  367.       if ((DetectionMode2 == 0) && (abs(startKnob - bitCrusher) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  368.         DetectionMode2 = 1;
  369.       }
  370.       if (DetectionMode2 == 1) {
  371.         bitCrusher = startKnob;
  372.       }
  373.       bitcrusher1.sampleRate(map(bitCrusher, 0, 1023, 1, 44100));              //samplerate 1-44100Hz controlled by startKnob
  374.       break;
  375.  
  376.     //4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
  377.     case 4: //delaytime + feedback
  378.       digitalWrite(L4Pin, HIGH);                                              //Led 4 aus
  379.       if ((DetectionMode == 0) && (abs(stationKnob - delayTime) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  380.         DetectionMode = 1;
  381.       }
  382.       if (DetectionMode == 1) {
  383.         delayTime = stationKnob;
  384.       }
  385.       delay1.delay(0, map(delayTime, 0, 1023, 3, 200));                     //delaytime 3-200ms controlled by stationknob
  386.       //--------------------------------------------------------------------------------------------------------------------------------------
  387.       if ((DetectionMode2 == 0) && (abs(startKnob - feedBack) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  388.         DetectionMode2 = 1;
  389.       }
  390.       if (DetectionMode2 == 1) {
  391.         feedBack = startKnob;
  392.       }
  393.       mixer3.gain(1, ((float)feedBack / 1023));                              //delayfeedback 0-1 controlled by startknob
  394.       break;
  395.  
  396.     //00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  397.     case 5: //Envelope1 Attack Release
  398.       digitalWrite(L1Pin, HIGH);
  399.       digitalWrite(L2Pin, HIGH);
  400.       if ((DetectionMode == 0) && (abs(stationKnob - attAck) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  401.         DetectionMode = 1;
  402.       }
  403.       if (DetectionMode == 1) {
  404.         attAck = stationKnob;
  405.       }
  406.       envelope1.attack((float)map(attAck, 0, 1023, 0, 2047));       //Filter1 filters cutoff
  407.  
  408.       //--------------------------------------------------------------------------
  409.       if ((DetectionMode2 == 0) && (abs(startKnob - reLease) < 10)) {         // Potiwert muss in die Naehe des letzten Wertes kommen
  410.         DetectionMode2 = 1;
  411.       }
  412.       if (DetectionMode2 == 1) {
  413.         reLease = startKnob;
  414.       }
  415.       envelope1.release((float)map(attAck, 0, 1023, 0, 4091));                //controls Resonance
  416.       break;
  417.     default:                                                                  //next taster push brings us back to page 0
  418.       mode = 0;
  419.   }
  420.   //end of page switching
  421.   //==================================================================================================
  422.  
  423.  
  424.  
  425. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement