-1

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();
Vishnu M S
  • 17
  • 3

1 Answers1

-1

A pitch can be lower than all the frequencies in the passband of the input filter (see "missing fundamental" in pitch estimation).

Depending on the width of the transition band, frequencies 20% above the cutoff frequency might only be partially attenuated by low pass filter.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153