从PCM获得频率数据我有音频数据的数组我传递给读者:我如何使用FFT
recorder.read(audioData,0,bufferSize);
的实例如下:
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.
我有一个我在网上找到了FFT类,并且有一个复杂的类可以与它一起使用。 我已经尝试了两天在网上查找,但无法解决如何循环存储在audioData
中的值并将其传递给FFT。
这是我使用的FFT类:http://www.cs.princeton.edu/introcs/97data/FFT.java ,这是复杂的类用它去:http://introcs.cs.princeton.edu/java/97data/Complex.java.html
我曾尝试过使用过零点方法,是否必须将数据从此方法传递到FFT? –