Teensy Audio Shield Not Detecting Anything from AUDIO_INPUT_LINEIN

Status
Not open for further replies.

RobertRobotics

New member
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.

AutoFisherFritzingDiagramImage.jpg

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);
}
 
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.
 
I am using a Rev C audio shield I believe... Here is the link to the shield.https://www.amazon.com/gp/product/B013V0ZK1E/ref=ppx_yo_dt_b_search_asin_title?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.
 
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.
 
Status
Not open for further replies.
Back
Top