I'm using TarsosDSP for an android project, and I'm getting this error:
Unable to start activity ComponentInfo{com.example.song2sheet/com.example.song2sheet.RecordingActivity}: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
From what I've read, to start taking samples all I need is this
AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(22050, 1024, 0);
PitchDetectionHandler detectionHandler = new PitchDetectionHandler() {
@Override
public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
final float pitchInHz = pitchDetectionResult.getPitch();
runOnUiThread(new Runnable() {
@Override
public void run() {
sampledFrequency = pitchInHz;
}
});
}
};
AudioProcessor pitchProcessor = new PitchProcessor(PitchProcessor.PitchEstimationAlgorithm.FFT_PITCH, 22020, 1024, detectionHandler);
dispatcher.addAudioProcessor(pitchProcessor);
Thread recordingThread = new Thread(dispatcher, "Recording Thread");
recordingThread.start();
but as seen above I'm getting an IllegalStateException.
Am I missing something from this code, as the error is being thrown on the first line?
Any help would be grand.
Thanks.