Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speech to Text from own sound file

As you probably know, implementing speech-to-text is pretty easy with the Android API. All you have to do is just call up the API's intent and it will return text for you. My case is a bit different, I have a prerecorded 3GPP sound file that I've recorded from the user and is saved on the SD card. I want to know if it's possible to transcribe that into text like any other speech recognition. Does the speech-to-text API allow for uploading you're own sound files to be processed? Or is this impossible?

like image 851
Brian Avatar asked Aug 08 '11 23:08

Brian


People also ask

Can we convert recorded speech to text?

There are two primary options to convert voice recordings to text documents. You can either use AI transcription or human transcription services. AI transcription is quicker and more affordable, but less accurate than human transcription.

Can Google Docs transcribe an audio file?

Google Docs can transcribe audio to text. This feature is known as voice typing. It is similar to the voice feature on google that allows you to search on the Google engine using your voice.


2 Answers

The API does not allow it, but see this blog post and its comments for a potential workaround. Also make sure that your file contains high quality audio (at least 16 bit and 16 kHz) to get a better transcription.

See also:

  • Voice recognition on android with recorded sound clip?
like image 89
Kaarel Avatar answered Oct 25 '22 10:10

Kaarel


I got a solution that is working well to have speech to text from a sound file. Here is the link to a simple Android project I created to show the solution's working. Also, I put some print screens inside the project to illustrate the app.

I'm gonna try to explain briefly the approach I used. I combined two features in that project: Google Speech API and Flac recording.

Google Speech API is called through HTTP connections. Mike Pultz gives more details about the API:

"(...) the new [Google] API is a full-duplex streaming API. What this means, is that it actually uses two HTTP connections- one POST request to upload the content as a “live” chunked stream, and a second GET request to access the results, which makes much more sense for longer audio samples, or for streaming audio."

However, this API needs to receive a FLAC sound file to work properly. That makes us to go to the second part: Flac recording

I implemented Flac recording in that project through extracting and adapting some pieces of code and libraries from an open source app called AudioBoo. AudioBoo uses native code to record and play flac format.

Thus, it's possible to record a flac sound, send it to Google Speech API, get the text, and play the sound that was just recorded.

The project I created has the basic principles to make it work and can be improved for specific situations. In order to make it work in a different scenario, it's necessary to get a Google Speech API key, which is obtained by being part of Google Chromium-dev group. I left one key in that project just to show it's working, but I'll remove it eventually. If someone needs more information about it, let me know cause I'm not able to put more than 2 links in this post.

like image 36
lsantsan Avatar answered Oct 25 '22 10:10

lsantsan