The Cloud Speech API enables easy integration of Google speech recognition technologies into developer applications.
-
Read Prerequisites and How to run a sample first.
-
Install dependencies:
npm install
View the documentation or the source code.
Usage: node recognize.js --help
Commands:
sync <filename> Detects speech in a local audio file.
sync-gcs <gcsUri> Detects speech in an audio file located in a Google Cloud Storage bucket.
async <filename> Creates a job to detect speech in a local audio file, and waits for the job to complete.
async-gcs <gcsUri> Creates a job to detect speech in an audio file located in a Google Cloud Storage bucket, and
waits for the job to complete.
stream <filename> Detects speech in a local audio file by streaming it to the Speech API.
listen Detects speech in a microphone input stream.
Options:
--help Show help [boolean]
--encoding, -e [string] [default: "LINEAR16"]
--sampleRateHertz, -r [number] [default: 16000]
--languageCode, -l [string] [default: "en-US"]
Examples:
node recognize.js sync ./resources/audio.raw -e LINEAR16 -r 16000
node recognize.js async-gcs gs://my-bucket/audio.raw -e LINEAR16 -r 16000
node recognize.js stream ./resources/audio.raw -e LINEAR16 -r 16000
node recognize.js listen
For more information, see https://cloud.google.com/speech/docs