Audio library installation problem

Status
Not open for further replies.

funfrancis

Well-known member
Hi

I am having trouble installing the Audio library from Github

I copied the library folder into Arduino ->libraries and the example folder into Arduino ->examples
But when I open the FFT codes, I get error

Code:
'myFFT' was not declared in this scope

what could possibly be the reason?

The weird part is I was using the Audio library for FFT last year but accidentally removed it.
 
Normally, you must install Teensyduino. Here is a video.

https://www.youtube.com/watch?v=uW8th5_ATGM

After you install Teensyduino (allow it to add the optional libraries), run Arduino, and then select Teensy 3.1/3.2 in the Tools > Boards menu. You must select Teensy first, because the File > Examples menu changes depending on which board you have selected.

Then you can access the audio library examples with File > Examples > Audio.

Please, do this the easy way. Start with a fresh & clean copy of Arduino, and then let the Teensyduino installer do the work of installing everything for you. Then you do not need to worry about the complex details of copying files to certain locations!
 
I got it installed

Thanks!!

I connected my mic and Pre-amp to the "Left Line-In" (like old times) for FFT but nothing is being displayed.
What could be the issue ??
 
We have the "Forum Rule" which appears in red at the top of every page. When you have a problem, you *must* post the code or clearly say exactly which code you are running. This rule applies for any problem, even "but nothing is being displayed". If you're running one of the libraries examples without any changes, it's enough to say exactly which one. But you must say this clearly in your message.

I know you are accustomed to Arduino's forum, which does not have this rule. Things work differently here. When asking for help with any problem which involves running a program on Teensy, you must always clearly state exactly which code you using. If the code is not an exact copy of a published example, you must show the code you are actually running.

Please, follow the Forum Rule. It saves everyone a lot of time and frustration and lets us give you much better help.
 
Im am using the FFT example code

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;
//const int myInput = AUDIO_INPUT_MIC;

// 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);
//AudioConnection patchCord1(sinewave, 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();
  }
}
 
That particular example always prints to the serial monitor, even when the sound input is silent.

After you upload to Teensy, wait a few seconds, and then check the Tools > Ports menu. You need to select the correct port before you open the serial monitor.

Teensy is different from regular Arduino, in that the serial port is *not* used for uploading. It's only for the serial monitor. So you can successfully upload, even if the wrong port is selected, but when you open the serial monitor, you can be listening to the wrong device and see nothing.
 
Hi

I built the pre-am for my microphone using http://www.sentex.ca/~mec1995/circ/preamp.gif

and I connected the output to "Left Line-In-Pin" but i do not receive any FFT data.
My output:
Code:
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -  
FFT:   -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -    -
What could be the problem??
 
Maybe it's not wired up properly. Can you post photos showing what you actually did?

If you have a voltmeter, try measuring the DC and AC voltage at the transistor's collector. You should see a constant DC somewhere between 0 to whatever voltage you're using to powering the circuit. You should see zero voltage AC when the room is silent, and a small changing AC voltage (like 0.1 to 0.25 volts) when you speak into the mic.
 
Yes, but does it really?

Can you understand the purpose of posting photos is so we can help you discover any mistakes? Nobody can help verify if the wire really is connected properly if you post a bad photo which does not show the connection!

You have posted so many questions here and on Arduino's forum, but you can't seem to understand you're communicating with real humans who might be able to help you, if only you give enough info. Please, try to understand how other people will view your question. You will save time, both yours, mine, and the valuable time of anyone who tries to help if you put more thought and effort into posting good questions with enough info for knowledgeable people to actually help. Please, I beg of you, do better in your questions. Everyone will benefit.
 
Hey Paul

The picture for your reference:
https://www.dropbox.com/s/iqjkvr6finxyr3e/20160311_133158.jpg?dl=0

Red wire - 3.3V
Brown - GND
Grey - Left Line In


The most important thing that you need to understand is that the reason for me to ask so many questions on FFT codes when there libraries available in Teensy and Arduino is because of the LoRa module that I am using for data transfer which I have told several times DOES NOT support Arduino and Teensy libraries. As a result, I am forced to draft my own codes (which I know is a tedious task) rather than depending completely on the library.
 
Status
Not open for further replies.
Back
Top