I am making an Android mobile app, where I have been trying to detect pitch using TarsosDSP. Which has been working great, only if it is greater than 43hz. But I have a requirement to make it work with 40hz. When I play the sound, it doesn't even give results below 43. This is where you can generate a tune online with the desired frequency. here is the code.
void connectsAudioDispatchertoMicrophone() {
AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(22050, 1024, 0);
PitchDetectionHandler pdh = new PitchDetectionHandler() {
@Override
public void handlePitch(final PitchDetectionResult result, AudioEvent e) {
final float pitchInHz = result.getPitch();
runOnUiThread(new Runnable() {
@Override
public void run() {
if (pitchInHz > 1)
Log.d(TAG, "pitchInHz: " + pitchInHz);
}
});
}
};
AudioProcessor p = new PitchProcessor(PitchProcessor.PitchEstimationAlgorithm.FFT_YIN,
22050,
1024,
pdh);
dispatcher.addAudioProcessor(p);
thread = new Thread(dispatcher, "Audio Dispatcher");
thread.start();
}