commit 07c66c917eb24bb7613d83c4de430e2b5fa763ae
parent df2fe15d3fad657871fea75d1e4aead4c9c8b1cc
Author: gstraube <gstraube@mailbox.org>
Date: Fri, 26 May 2017 18:30:28 +0200
Use FFT YIN algorithm for pitch detection
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/com/github/cythara/MainActivity.java b/app/src/main/java/com/github/cythara/MainActivity.java
@@ -12,19 +12,19 @@ import java.util.Locale;
import be.tarsos.dsp.AudioDispatcher;
import be.tarsos.dsp.AudioEvent;
-import be.tarsos.dsp.pitch.McLeodPitchMethod;
+import be.tarsos.dsp.pitch.FastYin;
import be.tarsos.dsp.pitch.PitchDetectionHandler;
import be.tarsos.dsp.pitch.PitchDetectionResult;
import be.tarsos.dsp.pitch.PitchProcessor;
import static be.tarsos.dsp.io.android.AudioDispatcherFactory.fromDefaultMicrophone;
-import static be.tarsos.dsp.pitch.PitchProcessor.PitchEstimationAlgorithm.MPM;
+import static be.tarsos.dsp.pitch.PitchProcessor.PitchEstimationAlgorithm.FFT_YIN;
public class MainActivity extends AppCompatActivity {
private static final int SAMPLE_RATE = 44100;
- private static final int BUFFER_SIZE = McLeodPitchMethod.DEFAULT_BUFFER_SIZE * 7;
- private static final int OVERLAP = McLeodPitchMethod.DEFAULT_OVERLAP;
+ private static final int BUFFER_SIZE = FastYin.DEFAULT_BUFFER_SIZE;
+ private static final int OVERLAP = FastYin.DEFAULT_OVERLAP;
final Handler updateHandler = new UpdateHandler(this);
final PitchListener pitchListener = new PitchListener(this);
@@ -74,7 +74,7 @@ public class MainActivity extends AppCompatActivity {
}
};
- PitchProcessor pitchProcessor = new PitchProcessor(MPM, SAMPLE_RATE,
+ PitchProcessor pitchProcessor = new PitchProcessor(FFT_YIN, SAMPLE_RATE,
BUFFER_SIZE, pitchDetectionHandler);
AudioDispatcher audioDispatcher = fromDefaultMicrophone(SAMPLE_RATE,