This is probably a very simple Signal Processing question but I can't quite work it out. I'm currently writing an android app which needs to perform an fft on audio data taken from the phone's microphone. I'm currently reading in the audio data into a byte array buffer at a sampling frequency of 44100Hz.
int bufferSize = AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT); final AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, 44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); final AudioTrack audioTrack = new AudioTrack( AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, bufferSize, AudioTrack.MODE_STREAM); final byte buffer = new byte[bufferSize]; final int finalBufferSize = bufferSize;
Once the buffer has been filled I convert the data to an array of Complex numbers and pass the data into an fft function. My problem is that the fft function I have cannot work with 44100 samples as it requires the length of the array of samples to be a power of 2. I've found what I think are some solutions online but I'm a little unsure if I'm fully understanding them correctly.
As I understand it I can either pad the array out with zeroes in order to make the array length a power of 2 or I can take a fixed fft size, e.g. 1024 samples. If I use the second solution do I need to divide the original array of samples into 1024 chunks and run an fft on each? Any advice on how I should go about this would be appreciated.
Here is the fft class I'm using: http://introcs.cs.princeton.edu/java/97data/FFT.java.html