I have an array of audio data that I pass to the reader:
recorder.read(audioData,0,bufferSize);
Creating an instance is as follows:
AudioRecord recorder; short[] audioData; int bufferSize; int samplerate = 8000; //get the buffer size to use with this audio record bufferSize = AudioRecord.getMinBufferSize(samplerate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT)*3; //instantiate the AudioRecorder recorder = new AudioRecord(AudioSource.MIC,samplerate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT,bufferSize); recording = true; //variable to use start or stop recording audioData = new short [bufferSize]; //short array that pcm data is put into.
I have an FFT class that I found online, and a complex class to go with it. I tried for two days to search the Internet everywhere, but I canβt figure out how to audioData
over the values ββstored in audioData
and transfer them to the FFT.
This is the FFT class that I use: http://www.cs.princeton.edu/introcs/97data/FFT.java and this is a complex class to go with it: http://introcs.cs.princeton.edu/java /97data/Complex.java.html
source share