I am making a custom keyboard app in which I want to add a microphone also. I want to record the audio and convert it to text. The tutorials available on the internet uses intent ( for calling another activity from the main activity). Since my app has no main activity, I am unable to use those tutorials for my code. I am able to record the audio in 3gp or mp3 format. I want to convert this to text. Could somebody please help me with this issue?
Recording audio:
mic_key = new MediaRecorder();
mic_key.setAudioSource(MediaRecorder.AudioSource.MIC);
mic_key.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mic_key.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
mic_key.setOutputFile(audio_file);
private void speak()
{
try
{
mic_key.prepare();
mic_key.start();
} catch (IOException e) {
e.printStackTrace();
}
Toast.makeText(EDMTKeyboard.this, "Recording Started", Toast.LENGTH_SHORT).show();
}
private void stop()
{
mic_key.stop();
mic_key.release();
Toast.makeText(EDMTKeyboard.this, "Recording Done", Toast.LENGTH_SHORT).show();
}
question from:
https://stackoverflow.com/questions/65886187/converting-recorded-audio-to-text-in-android-studio 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…