This is an example using Google's speech to text api. A little more details can be found on the blog below.
- Please install gcloud sdk first.
- Perform authentication and resolve associated dependencies.
$ gcloud auth application-default login
$ pip install -r requirements.txt
To convert a file to text in its entirety, proceed as follows.
$ python speech.py
Transcript: 안녕 하세요 좋은 아침입니다
The default is to specify test.raw via the audio-path
option.
Take a look at the options through help
as below.
$ python speech.py --help
usage: speech.py [-h] [--audio-path AUDIO_PATH]
[--language-code LANGUAGE_CODE]
speech to text
optional arguments:
-h, --help show this help message and exit
--audio-path AUDIO_PATH
Audio file to convert to text.
--language-code LANGUAGE_CODE
Language code. ( ko-KR, en-US, etc.. )
Here is an example of converting a file to streaming
.
The options are the same as for speech.py.
$ python speech_streaming.py
====================
transcript: 안녕 하세요 좋은 아침입니다
confidence: 0.5344622135162354
You need to install pypaudio
, please refer to the link below to install it first.
https://stackoverflow.com/a/33821084/4599185
After the installation is completed, you can do the following. Speech recognition is pending, so deliver voice over the microphone.
$ python transcribe_streaming_mic.py
Most of the sample code that is registered with googlecloudplatform
is used.