Page 1 of 1

Recording and Analyze

PostPosted: Sun Feb 19, 2012 4:03 am
by asmadi
Hi guys,

I want to doing a simple project to record the sound and analyze it with a simple formula (x*x). Where x is equal a realtime sound. I'm just MOD the board to suite using with microphone. I open the 'microphone.pde' and try it and success!. Only, the code for record the sound and pass data through. Just, somebody have some idea how I want to start to analyzed the sound without pass data through?

My requirement:

Sampling Freq = 22050Hz (16-bit)
Frame size or maybe buffer size= 1024 (this frame size for analyze using a simple formula, x*x)

so for 1 seconds i will have 22050 data point and approximately 21 frame (22050/1024 = 21.5).

I hope i will get some idea to try.. ;) Thank You

Re: Recording and Analyze

PostPosted: Sun Feb 19, 2012 12:14 pm
by guest
to create a buffer in memory
take a look at the exmple fixed_delay

Code: Select all
// create a delay buffer in memory
#define SIZE 800 // buffer size is limited by microcontroller SRAM size
int delaymem[SIZE]; // 800 positions x 2 bytes = 1600 bytes of SRAM
unsigned int location = 0; // buffer location to read/write from

there is a limit to the size of memory in the arduino
about 800 samples is the max

then you increment the sample counter in the ISR routine

to change to 22ksps you can do the following at the top
Code: Select all
#define SAMPLE_RATE 22 // 22.05Khz