1

I am working on an android project where I need to speech to text from audio buffer raw data or from a stored wav-file. Is it possible to do this on android? More specifically I get audio buffers from here

record.read(audioBuffer, 0, audioBuffer.length);

I process the audio buffer and store it as a wave file. I need to convert the processed audio buffer to text or after the audio buffer file has been saved as a wave file can I then convert the wav to text using googles offline speech to text option. Please let me know how do I do this. I have seen other threads here but they are very old. (like 4,6,7 years old....)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
threewire
  • 471
  • 1
  • 4
  • 13

1 Answers1

0

I came across google's could speech API which can take a raw audio file as input and perform asynchronous speech recognition. I have limited app development experience and with java. https://cloud.google.com/speech/docs/async-recognize This link shows how to and here is some elongated source code https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/speech/cloud-client/src/main/java/com/example/speech/QuickstartSample.java. But problem is when I added the following import statements to my application code in android studio mainactivity.java the get greyed out and some are marked in red.

import com.google.cloud.speech.v1.RecognitionAudio;
import com.google.cloud.speech.v1.RecognitionConfig;
import com.google.cloud.speech.v1.RecognitionConfig.AudioEncoding;
import com.google.cloud.speech.v1.RecognizeResponse;
import com.google.cloud.speech.v1.SpeechClient;
import com.google.cloud.speech.v1.SpeechRecognitionAlternative;
import com.google.cloud.speech.v1.SpeechRecognitionResult;
import com.google.protobuf.ByteString;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
threewire
  • 471
  • 1
  • 4
  • 13
  • After I installed the cloud api sdk I no longer faced this problem. These are not default android libraries but one needs to install the SDK. – threewire Dec 04 '17 at 10:33