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

Thread: Teensy Audio Shield Not Detecting Anything from AUDIO_INPUT_LINEIN

  1. #1

    Teensy Audio Shield Not Detecting Anything from AUDIO_INPUT_LINEIN

    Hey guys,

    I am trying to do an FFT on some audio coming from a Nintendo Switch. I have an aux cord plugged directly into the switch and then have it soldered into the line in as shown in the attached image. I had the FFT working and running well using this exact same setup a couple of months ago, but upon revisiting this project with the same code it is no longer working. The FFT does not show any noise coming from the Switch at all across the list of frequencies. Any help would be greatly appreciated.

    Here is the code and fritzing diagram. All connections to the audio shield and AUX cord are good. I used a DMM to ring out the pins, and AUX cord.

    Click image for larger version. 

Name:	AutoFisherFritzingDiagramImage.jpg 
Views:	11 
Size:	38.7 KB 
ID:	21031

    Code:
    // FFT Test
    //
    // Compute a 1024 point Fast Fourier Transform (spectrum analysis)
    // on audio connected to the Left Line-In pin.  By changing code,
    // a synthetic sine wave can be input instead.
    //
    // The first 40 (of 512) frequency analysis bins are printed to
    // the Arduino Serial Monitor.  Viewing the raw data can help you
    // understand how the FFT works and what results to expect when
    // using the data to control LEDs, motors, or other fun things!
    //
    // This example code is in the public domain.
    
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    const int myInput = AUDIO_INPUT_LINEIN;
    
    // Create the Audio components.  These should be created in the
    // order data flows, inputs/sources -> processing -> outputs
    //
    AudioInputI2S          audioInput;         // audio shield: mic or line-in
    AudioSynthWaveformSine sinewave;
    AudioAnalyzeFFT1024    myFFT;
    AudioOutputI2S         audioOutput;        // audio shield: headphones & line-out
    
    // Connect either the live input or synthesized sine wave
    AudioConnection patchCord1(audioInput, 0, myFFT, 0);
    AudioControlSGTL5000 audioShield;
    
    void setup() {
      // Audio connections require memory to work.  For more
      // detailed information, see the MemoryAndCpuUsage example
      AudioMemory(12);
    
      // Enable the audio shield and set the output volume.
      audioShield.enable();
      audioShield.inputSelect(myInput);
      audioShield.volume(0.5);
    
      // Configure the window algorithm to use
      myFFT.windowFunction(AudioWindowHanning1024);
      //  myFFT.windowFunction(NULL);
    
      // Create a synthetic sine wave, for testing
      // To use this, edit the connections above
      sinewave.amplitude(0.8);
      sinewave.frequency(1034.007);
    }
    
    void loop() {
      float n;
      int i;
      if (myFFT.available()) {
        // each time new FFT data is available
        // print it all to the Arduino Serial Monitor
        Serial.print("FFT: ");
        for (i = 0; i < 40; i++) {
          n = myFFT.read(i);
          if (n >= 0.01) {
            Serial.print(n);
            Serial.print(" ");
          } else {
            Serial.print("  -  "); // don't print "0.00"
          }
        }
      }
      Serial.println();
      delay(100);
    }

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    406
    Have you tried the right channel?

    Or selecting microphone input?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,774
    Which Teensy and version of the audio shield are you using?

    I could give your code a try here, but I need to at least know which hardware you're using so I run it the same way.

  4. #4
    I am using a Rev C audio shield I believe... Here is the link to the shield.https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

    I used a Teensy 3.2 a couple of weeks ago and managed to make this exact code work. I just bought a 4.0, and when I flashed the code on it for some reason I can't pick up on anything at all. I switched back to the 3.2, but it still isn't working after going back. I tried using the right channel and microphone input as well, but for some reason the Switch audio just doesn't come through.

  5. #5
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    132
    Hi RobertRobotics,

    For the Teensy 4.0 you need a Rev D shield - https://www.pjrc.com/store/teensy3_audio.html.

  6. #6
    I'm using a Teensy 3.2 with a Rev C shield. I started to use the 4.0, but realized it wasn't working, went back to the 3.2, and it stopped working. Is it possible I fried the board with a 4.0 or something? I don't really see what could be causing me to not pick up any audio in my FFT with a Teensy 3.2 and Rev C audio shield.

Posting Permissions

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