Writer writer = new Writer();
 String data = writer.toString();/* the value is not casting and displaying null...*/
Run Code Online (Sandbox Code Playgroud)
有没有其他方法将编写器转换为字符串?
我需要使用带通滤波器来过滤我的实时录制音频.范围约为18Khz至22Khz.我见过很多例子,不幸的是它们被用来检测音频的频率......因为我是DSP的新手,请为你的答案做好准备....
我的错频率,我不明白为什么我得到错误的值.因为我按照指令计算后跟stackoverflow.我使用了来自http://introcs.cs.princeton.edu/java/97data/FFT.java.html的 FFT和 http://introcs.cs.princeton.edu/java/97data/Complex.java中的 复合体 . HTML
audioRec.startRecording();
audioRec.read(bufferByte, 0,bufferSize);
for(int i=0;i<bufferSize;i++){
    bufferDouble[i]=(double)bufferByte[i];    
    }
Complex[] fftArray = new Complex[bufferSize];
    for(int i=0;i<bufferSize;i++){
    fftArray[i]=new Complex(bufferDouble[i],0);
    }
    FFT.fft(fftArray);
double[] magnitude=new double[bufferSize];
for(int i=0;i<bufferSize;i++){
      magnitude[i] = Math.sqrt((fftArray[i].re()*fftArray[i].re()) + (fftArray[i].im()*fftArray[i].im()));
    }
double max = 0.0;
int index = -1;
for(int j=0;j<bufferSize;j++){
    if(max < magnitude[j]){
            max = magnitude[j];
        index = j;
        }
    }
    final int peak=index * sampleRate/bufferSize;
    Log.v(TAG2, "Peak Frequency = " + index * sampleRate/bufferSize);
    handler.post(new Runnable() {
            public void run() {
                textView.append("---"+peak+"---");
            } …Run Code Online (Sandbox Code Playgroud)