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

Thread: Teensy 4.1 noise when adjusting audio delay effects delay length.

  1. #1

    Teensy 4.1 noise when adjusting audio delay effects delay length.

    I've been messing around with the Teensy 4.1 and the audio library and noticed when I play audio through a delay block and adjust the delay length it makes a crackling sound. Is this normal? Does this happen on the Teensy 3.6 as well?

    Here's the simplified code:
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s1;           //xy=385,211
    AudioEffectDelay         delay1;         //xy=683,309
    AudioMixer4              mixer1;         //xy=853,238
    AudioOutputI2S           i2s2;           //xy=987,232
    AudioConnection          patchCord1(i2s1, 1, delay1, 0);
    AudioConnection          patchCord2(i2s1, 1, mixer1, 0);
    AudioConnection          patchCord3(delay1, 0, mixer1, 1);
    AudioConnection          patchCord4(mixer1, 0, i2s2, 1);
    AudioControlSGTL5000     sgtl5000_1;     //xy=393,306
    // GUItool: end automatically generated code
    
    
    #include <Encoder.h>
    Encoder delayEnc(38,39);
    int delayVal;
    int oldDelayPos;
    
    void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      AudioMemory(100);
      mixer1.gain(0,1); // dry
      mixer1.gain(1,1); // delay
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      long newDelayPos = delayEnc.read();
      long delayVal1 = (newDelayPos - oldDelayPos);
      delayVal = delayVal+delayVal1;
      
      if (delayVal <= 0){
        delayVal = 0;
      }
      if (delayVal >= 1000){
        delayVal = 1000;
      }    
      if (newDelayPos != oldDelayPos){
        oldDelayPos = newDelayPos; 
        Serial.print("delayVal = ");
        Serial.println(delayVal);
      }
    
      //Set output channel (0 to 7) to delay the signals by milliseconds. 
      //See the table below for the maximum delay. The actual delay is rounded to the nearest sample. 
      //Each channel can be configured for any delay. There is no requirement to configure the "taps" in increasing delay order. 
      //if (delaysmoothing >= 10){
      delay1.delay(0, delayVal); //Teensy 3.6 2413.94 ms
    
    }
    Also from the digging that I've done its seems like the audio library isn't able to make use of the teensy 4.1 extended psram yet. Like the delayExt, granular effect or other memory intensive effects?

  2. #2
    In case anyone has similar questions in the future I found this thread.

  3. #3
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    130
    hi cfredisded

    in your example code, it updates the delay time every time you go around the loop - for the T4 this will be really fast (lots of time per sample?).

    if you are just looking to adjust delay time with a pot you may get less distortion if you only update the delay object when the pot changes and also reduce how often you check the pot (every x millisecond).

    cheers, paul

  4. #4
    Quote Originally Posted by houtson View Post
    hi cfredisded

    in your example code, it updates the delay time every time you go around the loop - for the T4 this will be really fast (lots of time per sample?).

    if you are just looking to adjust delay time with a pot you may get less distortion if you only update the delay object when the pot changes and also reduce how often you check the pot (every x millisecond).

    cheers, paul
    I did try setting up a timer and and only adjusting the delay time up to even every 10 ms. I also tried slowing the clock speed of the Teensy 4.1 and it seemed more noticeable. I think its just fundamentally not possible. I believe, It would actually have to move where its reading and writing depending how fast the delay time is changing, basically making it a modulated delay. but thanks for the suggestion. I'm currently looking through bleeplabs fork of the audio library and he has a tape delay object that might work

Posting Permissions

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