Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speech: add livecaption #169

Merged
merged 7 commits into from
Nov 17, 2016
Merged

speech: add livecaption #169

merged 7 commits into from
Nov 17, 2016

Conversation

rakyll
Copy link
Contributor

@rakyll rakyll commented Nov 17, 2016

No description provided.

defer conn.Close()

// [START speech_streaming_mic_recognize]
stream, err := speech.NewSpeechClient(conn).StreamingRecognize(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err != nil {
log.Fatal(err)
}
// send the initial configuration message.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentence casing, please (and in the two comments below)

// Send the initial configuration message.

return // nothing else to pipe, kill this goroutine
}
if err != nil {
log.Printf("Reading stdin error: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not read from stdin"

AudioContent: buf[:n],
},
}); err != nil {
log.Printf("Sending audio error: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not send audio:"

break
}
if err != nil {
log.Fatalf("stream.Recv error: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"stream.Recv: %v"

unless there's a better way to describe what might have happened

log.Fatalf("stream.Recv error: %v", err)
}
if err := resp.Error; err != nil {
log.Fatalf("Recieved error resp: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not recognize"?

buf := make([]byte, 1024)
for {
n, err := os.Stdin.Read(buf)
if err == io.EOF {
return // nothing else to pipe, kill this goroutine
return // Nothing else to pipe, returns from this goroutine.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just return, not returns

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@broady
Copy link
Contributor

broady commented Nov 17, 2016

LGTM, one nit

@broady broady merged commit b4f1095 into master Nov 17, 2016
@broady broady deleted the livecaption branch November 17, 2016 22:51
@broady
Copy link
Contributor

broady commented Nov 17, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants