Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Dry/wet effect

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    5

    Dry/wet effect

    Goodmorning everyone.
    I write from Italy, excuse my English.
    I have a question:
    How can I integrate a "dry/wet" function from a pot on teensy?
    I have a simple sketch of delay effect.
    thanks

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,592
    You would have to add a mixer object. On one input, you'd connect the original signal, on the other the delayed signal. Then you would have to add code to read a potentiometer and to scale the readings down to a float variable between 0.0f and 1.0f, lets call it dw_val. Finally, you'd set the two mixer channel volumes synchronously, the delayed signal with dw_val and the original signal with (1 - dw_val), so that the signal remains at same strength in the sum, and that at the extremes you get the pure dry or delayed signals: if dw_val is 0.0, no delay would fully come through the mixer, and the volume for the original signal would be 1.0 - 0.0 = 1.0, thus the sum would be perfectly dry. If dw_val is 1.0, the delayed signal would fully come through the mixer, and the volume for the original signal would be 1.0 - 1.0 = 0.0, thus the sum would be perfectly wet.

    BTW:
    I write from Italy, excuse my English.

    That's not an excuse... everybody can make the effort to learn foreign languages, even French and Italian people

  3. #3
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    Tonight I try and I uploaded the code.
    It was obvious, but I did not think about it
    Thank you so much

    Quote Originally Posted by Theremingenieur View Post
    That's not an excuse... everybody can make the effort to learn foreign languages, even French and Italian people
    You're right, but I currently have little time.
    Work, projects, women

  4. #4
    Junior Member
    Join Date
    Dec 2017
    Posts
    5
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioInputUSB            usb1;           //xy=368,492
    AudioInputI2S            i2s1;           //xy=393.5,427.25
    AudioMixer4              mixer1;         //xy=585,601.25
    AudioMixer4              mixer3;         //xy=607,375
    AudioEffectDelay         delay1;         //xy=755.0000114440918,737.5000152587891
    AudioMixer4              mixer2;         //xy=1014.75,518.361083984375
    AudioOutputI2S           i2s2;           //xy=1197.5,631.25
    AudioConnection          patchCord1(usb1, 0, mixer3, 2);
    AudioConnection          patchCord2(usb1, 1, mixer3, 3);
    AudioConnection          patchCord3(i2s1, 0, mixer3, 0);
    AudioConnection          patchCord4(i2s1, 1, mixer3, 1);
    AudioConnection          patchCord5(mixer1, delay1);
    AudioConnection          patchCord6(mixer3, 0, mixer2, 0);
    AudioConnection          patchCord7(mixer3, 0, mixer1, 0);
    AudioConnection          patchCord8(delay1, 0, mixer2, 1);
    AudioConnection          patchCord9(delay1, 0, mixer1, 3);
    AudioConnection          patchCord10(mixer2, 0, i2s2, 0);
    AudioConnection          patchCord11(mixer2, 0, i2s2, 1);
    AudioControlSGTL5000     sgtl5000_1;     //xy=450.00000762939453,766.2500133514404
    // GUItool: end automatically generated code
    
    void setup() {
      Serial.begin(9600);
      //pinMode(0, INPUT_PULLUP);
      AudioMemory(190);
      sgtl5000_1.enable();
      sgtl5000_1.volume(0.7);
      //sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN);
      sgtl5000_1.adcHighPassFilterDisable(); // reduction of noise floor in some cases
      
        mixer1.gain(0, 0.5);
        mixer1.gain(3, 0);
        delay1.delay(0, 100);
        mixer2.gain(0, 1);
        mixer2.gain(1, 0);
      
      //delay(1000);
    }
    
    void loop() {
      
      //lettura pot 2 controllo feedback delay
      int knob = analogRead(A1);
      float feedback = (float)knob / 1050.0;
      mixer1.gain(3, feedback);
    
      //lettura pot 1 per controllo tempo delay
      int knob2 = analogRead(A0);
      int tempo = map(knob2, 0, 1024, 0, 500);
      delay1.delay(0, tempo);
    
      //lettura pot 3 per controllo dry/wet
      int knob3 = analogRead(A2);
      float dw_val = (float)knob3 / 1050.0;
      mixer2.gain(0, 1.00 - dw_val);
      mixer2.gain(1, dw_val);
      delay(60);
    }

    it's work! thanks you

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,592
    You are welcome! I’m glad that I could help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •