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

Thread: AudioConnection patchCord with delay breaks program

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    2

    AudioConnection with delay breaks program

    Hello,

    I developed a program on a Teensy 3.2 and am now trying to get it going on a Teensy 3.6. It's a simple delay line (actually two delay lines in series for a longer total delay). However, it doesn't work on the Teensy 3.6.

    The program seems to break (no audio output) as soon as I introduce any AudioConnection involving a delay. If I comment those AudioConnection lines out, the program works.

    I've checked these parts individually and they seem fine:
    - Mic throughput to the speaker works, which suggests that all my hardware and connections are in good shape.
    - Delays work in the Examples > Audio > Effects > Delay demo program for Teensy 3.6, but it uses a synth instead of AudioInputI2S.
    - AudioConnection messages work fine as long as a delay isn't involved.

    The code is below with annotations. Is this a problem of portability to Teensy 3.6? Is there a different way to achieve this (mic into a delay line)?

    Thanks!

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s1;           //xy=60,25
    AudioEffectDelay         delay1;         //xy=238,284
    AudioMixer4              mixer1;         //xy=248,38
    AudioEffectDelay         delay2;         //xy=382,282
    AudioOutputI2S           i2s2;           //xy=531,242
    //AudioConnection          patchCord1(i2s1, 0, i2s2, 0);   // mic throughput just for testing
    AudioConnection          patchCord1(i2s1, 0, mixer1, 0);   // use this instead of throughput when delays are fixed
    AudioConnection          patchCord2(delay1, 0, delay2, 0); // any of these will break it
    AudioConnection          patchCord3(mixer1, delay1);       // any of these will break it
    AudioConnection          patchCord4(delay2, 0, mixer1, 1); // any of these will break it
    AudioConnection          patchCord5(delay2, 0, i2s2, 0);   // any of these will break it
    AudioControlSGTL5000     sgtl5000_1;     //xy=114,152
    // GUItool: end automatically generated code
    
    void setup() {
      Serial.begin(9600);
      pinMode(0, INPUT_PULLUP);
      AudioMemory(120); // Was 160 in the working version on Teensy 3.2
      sgtl5000_1.enable();
      sgtl5000_1.volume(1.);
      sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
      sgtl5000_1.micGain(63);
      mixer1.gain(0, 1.);
      mixer1.gain(1, 1.);
      delay1.delay(0, 110); // Was 425 in the working version on Teensy 3.2
      delay2.delay(0, 110); // Was 425 in the working version on Teensy 3.2
      delay(1000);
      sgtl5000_1.audioPreProcessorEnable();
    }
    
    void loop() {
    }
    Last edited by M620sound; 06-09-2017 at 05:17 PM. Reason: Adding information

  2. #2
    Junior Member
    Join Date
    Jun 2017
    Posts
    2
    Well, I seem to have my code working now on Teensy 3.6. It appears that using the serial port:

    Serial.begin(9600);

    in conjunction with connecting a delay, e.g.:

    AudioConnection patchCord5(delay2, 0, i2s2, 0);

    caused audio to break. Serial port may have been working; I wasn't monitoring that. I still don't see why these two are incompatible, but I don't need the serial port for this project.

Tags for this Thread

Posting Permissions

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