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.
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.
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);
}