transcribe-live-audio
transcribe-live-audio copied to clipboard
Transcribe live audio using Google Cloud Speech to Text API
transcribe-live-audio
Transcribe live audio using Google Cloud Speech to Text API
The script provides a workaround for the 60s time limit restriction posed by Google Cloud Speech to Text API.
Solution Approach
The script stages the the audio/microphone input into a buffer before transcribing the "audio chunks" from the buffer using the API. That way, when the existing API client returns a time out error it is simply reinitialized and the new client will continue transcribing the audio from the buffer.
To run the demo
Do not forget to configure environment variable GOOGLE_APPLICATION_CREDENTIALS
with the GCP credentails JSON file path
export GOOGLE_APPLICATION_CREDENTIALS='/path/to/credentials.json'
Install dependencies
npm install
Show help
node transcribe.js -h
Example
node transcribe.js -e LINEAR16 -r 16000 -l hi-IN