livecaption

command
v0.0.0-...-36feec3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

Google Cloud Speech API Go example

Authentication

  • Create a project with the Google Cloud Console, and enable the Speech API.

  • From the Cloud Console, create a service account, download its json credentials file, then set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
    

Run the sample

Before running any example you must first install the Speech API client:

go get -u cloud.google.com/go/speech/apiv1

To run the example with a local file:

go build
cat ../testdata/audio.raw | livecaption

Alternatively, gst-launch can be used to capture audio from the mic:

gst-launch-1.0 -v pulsesrc ! audioconvert ! audioresample ! audio/x-raw,channels=1,rate=16000 ! filesink location=/dev/stdout | livecaption

Documentation

Overview

Command livecaption pipes the stdin audio data to Google Speech API and outputs the transcript.

As an example, gst-launch can be used to capture the mic input:

$ gst-launch-1.0 -v pulsesrc ! audioconvert ! audioresample ! audio/x-raw,channels=1,rate=16000 ! filesink location=/dev/stdout | livecaption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL