I want to filter the incoming audio before doing a pitch detection using tarsosDSP. I have tried to add a high pass and low pass filter before pitch detection. But still, the pitch detection outputs all frequencies even outside the range say, 300hz or 6000Hz. Is there any problem in the code?
PitchDetectionHandler handler = new PitchDetectionHandler() {
@Override
public void handlePitch(PitchDetectionResult pitchDetectionResult,
AudioEvent audioEvent) {
System.out.println(audioEvent.getTimeStamp() + " " +pitchDetectionResult.getPitch());
}
};
AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(44100,2048,0);
dispatcher.addAudioProcessor(new LowPassFS(5000, 44100));
dispatcher.addAudioProcessor(new HighPass(2000, 44100));
//dispatcher.run();
dispatcher.addAudioProcessor(new PitchProcessor(PitchProcessor.PitchEstimationAlgorithm.YIN, 44100, 2048, handler));
new Thread(dispatcher,"Audio Dispatcher").start();