0

I have a simple code for processing a float buffer with a lowpass filter. Here's the function:

    public static float[] lowPass(float[] buffer, float frequnecy) {

    AudioFormat audioFormat = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
    AudioEvent audioEvent = new AudioEvent(audioFormat, 1024);
    audioEvent.setFloatBuffer(buffer);

    LowPassFS lowPassFilter = new LowPassFS(frequnecy, DSP.SAMPLE_RATE);
    lowPassFilter.process(audioEvent);

    return audioEvent.getFloatBuffer();
}

The result is that the buffer isn't processed at all and returned as is. I can't find a related working example anywhere tough.

Thanks in advance

vitasia1
  • 23
  • 1
  • 7

1 Answers1

0

Try replacing getFloatBuffer() with getByteBuffer(), it may be that the float buffer holds the input value, but I have made a low pass filter successfully (it doesn't work too well above cut off of 300Hz though) and getByteBuffer() definitely gives the filtered values.

David Guyon
  • 2,759
  • 1
  • 28
  • 40
A B
  • 189
  • 2
  • 9