Sound detecting project

Status
Not open for further replies.

Wicky21

Well-known member
First of all i wanted to say i'm new to Teensy.

Guys please tell me whether below requirements can be successfully achieved by Teensy 3.2 (Also guys keep remember i'm not going to use audio shield because my requirement is to create a small device)

1) I thought to use - " Adafruit AGC Electret Microphone Amplifier - MAX9814 ". It needs to connect for ADC pin and sample at lower sampling rate (Below 44 KHz, Since my ADC picks signals only upto 3KHz maximum. I'm using a technique of PLL to trigger the Teensey 3.2 and when the signal present at that level it should begin to sample. So no point to use higher sampling rate). So is that possible to change the pre-scalar values of ADC at teensy? If so please post the links for the libraries and share threads.

2) I needed to implement a DSP filter inside the MCU. so simply i want to make IIR bandpass filer inside the chip. Is their any libraries for teensy 3.2? or else please provide me the links and libraries to refer on. I already found constant values from MATLAB

3) Next step i want to store all the captured samples on a SD card. (with .wav format) Is that possible ? and what are the libraries which capable of doing that?

4) Final stage again access SD card and convert .wav files into FFT and analyze frequncy bins. What are the libraries and please share links


Guys please tell me whether Teensy 3.2 is capable of doing all this steps. And please share all the links and libraries on each particular steps.
 
Last edited:
A teensy can do all these things, how possible that is for you depends on how tight your spec is. A lot of this is done by the audio library

https://www.pjrc.com/teensy/td_libs_Audio.html

If your end specs are tweakable enough to accept 44khz sampling you should be able to FFT audio from an ADC pin in real time. If you want to do custom sample rates via your own ADC and roll your own signal processing that will mean looking at the audio library and cutting back, or starting with the ADC library and working up
https://github.com/pedvide/ADC

Hardware can certainly do it, but getting to where you want to be may be a convoluted process.
 
1) I thought to use - " Adafruit AGC Electret Microphone Amplifier - MAX9814 ".

This Adafruit mic has been tested and works with a small mod.

https://forum.pjrc.com/threads/4046...io-Lib-results?p=126317&viewfull=1#post126317

That mod allows that specific Adafruit board to connect directly, which should give you the smallest physical build.

The MAX9814 can probably also work, but you'll need this circuit to adapt:

adccircuit.png


Details here: (right side panel)

https://www.pjrc.com/teensy/gui/?info=AudioInputAnalog

2) I needed to implement a DSP filter inside the MCU. so simply i want to make IIR bandpass filer inside the chip. Is their any libraries for teensy 3.2?

Yes, the audio lib has biquad and state variable filters (both IIR)

https://www.pjrc.com/teensy/gui/?info=AudioFilterBiquad

https://www.pjrc.com/teensy/gui/?info=AudioFilterStateVariable


3) Next step i want to store all the captured samples on a SD card. (with .wav format) Is that possible ? and what are the libraries which capable of doing that?

In Arduino, with Teensy selected in Tools > Boards, click File > Examples > Audio > Recorder.

4) Final stage again access SD card and convert .wav files into FFT and analyze frequncy bins. What are the libraries and please share links

The audio lib is set up to the FFT in real time. Check out part 3-2 of the tutorial.

https://www.pjrc.com/store/audio_tutorial_kit.html

If you skip parts of this tutorial, please do read or watch the first part about the design tool, and then spend a moment actually looking around in the design tool at the many options it has that aren't demonstrated in the video (especially the ways to get sound in and out other than the audio shield).
 
PaulStoffregen; The audio lib is set up to the FFT in real time [/QUOTE said:
Thanks a lot Paul. One thing i needed to know. could you please explain how FFT algorithm works? Did you have any explanation about how internal fft algorithm works? Because i haven't used it yet. I already used FFT library on arduino and analyzed spectrum. But has no idea how internally it works. So in teensy 3.2 i needed to know what exactly goes on.
I made MATLAB algorithm to avoid noise by averaging the samples. So in MATLAB if i sent a .wav file directly inside to fft() i get a result like below figure

2.direct_fft_zoom.jpg

But i made an algorithm to average fft samples. After that outputs looks like below figure

5.FFT_averaging.jpg

As you can see by doing this technique noises can be cancelled. Is there any mechanism inside fft library?
 
could you please explain how FFT algorithm works?

Did you read the tutorial PDF and/or watch the walkthrough video? I put quite a bit of work into explaining FFT in that tutorial, and Alysia and I actually did the tutorial demo in the video so you can actually see & hear it.

As for the deeper theory of how FFT computation works, you can find that in many textbooks and website.
 
Did you read the tutorial PDF and/or watch the walkthrough video? I put quite a bit of work into explaining FFT in that tutorial, and Alysia and I actually did the tutorial demo in the video so you can actually see & hear it.

As for the deeper theory of how FFT computation works, you can find that in many textbooks and website.

Ya I read the pdf and watched tutorials. I need to know how you implemented the code. I mean deeper level of explanation of created the fft library
 
Ya I read the pdf and watched tutorials. I need to know how you implemented the code. I mean deeper level of explanation of created the fft library

A small hint: try to understand the source code in the audio library. If you have specific questions, ask on this forum.
 
I need to know how you implemented the code.

The actual FFT computation is done by the arm_math.h library. The audio lib just queues up data, applied the window, lets arm_math's functions do the heavy lifting, and it does some post processing to turn complex numbers to magnitude only.

You can see the audio lib code here, and also in hardware/teensy/avr/libraries/Audio on your computer.

https://github.com/PaulStoffregen/Audio/blob/master/analyze_fft1024.cpp

You can see the arm_math code here:

https://github.com/PaulStoffregen/arm_math/tree/master/src

This is as much as I'm going to write for you. If you want more, you can get it from the code.

Just curious, is this for a school or other academic project?
 
Status
Not open for further replies.
Back
Top