Store › Forums › Audio Hacker › Discussion and Project Ideas › Arduino and AudioHacker spectrum analyzer
- This topic has 5 replies, 2 voices, and was last updated 9 years, 3 months ago by Michael.
-
AuthorPosts
-
August 7, 2015 at 8:35 pm #781memoguerequeMember
Hello,
I am kind of new on the audio processing, sampling etc. I was wandering if it is possible to develop a spectrum analyzer with this shield.
I have done one to analyze noise on certain frequencies using an arduino and a sparkfun eclect microphone, basically with an FFT library for arduino, the microphone (with the necessary on board amplifiers and filters i needed) connected to an analog input on the arduino, and a c# program just to graph the decibels on its bands of frequencies.
The problem was that i could analyze up to less than 20 kHz (11 kHz aprox) and because the electronics, the piezo in the little microphone and some other factors, i had troubles regarding noise on the inputs.
I would like to do so, with a microphone connected on the audio input of this shield. But i really really new to this shield and how it works (the libraries). If possible, can someone guide on how this could work with the shield.
I would like to analyze 20Khz (sample rate at about 40khz) with a band of 50 hz if possible (the FFT library that i used had 128 bands of resolution.
Thank you very much
August 10, 2015 at 8:56 pm #2318MichaelKeymasterYou can sample the ADC at that rate, and you should have enough memory in SRAM to store your data for the FFT. I am doing FFT on an Arduino now (for another project, and not using the Audio Hacker), and there’s enough memory for a 256 point FFT. I think it should work.
August 13, 2015 at 11:13 pm #2322memoguerequeMemberThank you very much for your reply, Michael.
Yes. It actually works. The thing is ( and at this point i don’t really know if I understood the full concept of FFT) for what i understand, a 250 point FFT means 128 bands of frequencies due to the nyquist theorem, right?
Because of the high noise level on the project and some other factors i came to the conclusion of using a 512 or even a 1024 point FFT and see the results, plus recording the noise for future references.
I was thinking of audio hacker to record samples and analyze the sound in FFT. Is it possible with arduino and audiohacker to do that?
Thank you.
August 14, 2015 at 12:25 pm #2323MichaelKeymasterI think you could record sound to the serial SRAM chips (for large capacity), then in small chunks at a time (like 512 bytes) load data from serial SRAM into a normal SRAM buffer and pass it to the FFT code.
For example, sample 512 12-bit values and write each value with:
writeSRAM(0, 0, data)
Note that each sample will take up 2 bytes. Do this until memory is full.
For later analysis:
unsigned int buf[512]; // buffer to store the 512 unsigned ints
readSRAM(0, 0, (byte *)buf, 1024); // do 1024 reads into the buffer, two bytes per sample. Now buf[] will contain 1024 bytes which are actually 512 unsigned ints.
// pass buf to your FFT code.August 17, 2015 at 10:45 pm #2328memoguerequeMemberThank you very much Michael,
I will get my hands on to that!
Another question: Is it possible to use 3 analog pins for other purposes ( i want to connect a 3 axis accelerometer) or does the chip uses all of the analog pins to sample audio?
Thanks
August 18, 2015 at 3:27 am #2329MichaelKeymasterYou can use the analog pins. This shield uses an ADC chip to sample audio and does not use the ADC on the Arduino.
-
AuthorPosts
- You must be logged in to reply to this topic.