Recording From Microphone

All your problems with Audio, Video and Images.

Recording From Microphone

Postby leptictidium » Sun Jul 17, 2011 11:47 pm

I need to display the frequency of the microphone input in real time. From my research so far I know that you have to get the audio buffer data and perform and FFT on it. I have found a library to do FFT here:
https://sites.google.com/site/piotrwend ... transforms
Once you have the results of the FFT you take the absolute value of it and then do something else to get the frequency, but right now I'm mainly concerned with doing the FFT itself.

I am new to android development. Could anyone show me how to perform the FFT on the audio buffer? Thanks.

I think you get the buffer like this:
Code: Select all
int channel_config = AudioFormat.CHANNEL_CONFIGURATION_MONO;
                      int format = AudioFormat.ENCODING_PCM_16BIT;
                      int sampleSize = 8000;
                      int bufferSize = AudioRecord.getMinBufferSize(sampleSize, channel_config, format);
                      AudioRecord audioInput = new AudioRecord(AudioSource.MIC, sampleSize, channel_config, format, bufferSize);
                      short[] audioBuffer = new short[bufferSize];
                      
leptictidium
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 20, 2011 11:21 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests