GoogleCloudPlatform / GoogleCloudPlatform/java-docs-samples

InfiniteStreamRecognize - io.grpc.StatusRuntimeException: CANCELLED: Failed to read message when EnableVoiceActivityEvents is true

Open
#8,950 5 comments 0 reactions 1 assignee Assigned to @ssvir View on GitHub
priority: p2 samples type: question
Dominant language
Java
Stars
1.9k
Forks
2.9k
Avg merge
3d 3h
Merged PRs (30d)
17

Description

## In which file did you encounter the issue?
https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/speech/src/main/java/com/example/speech/InfiniteStreamRecognize.java

## Did you change the file? If so, how?
Added enable voice activity event option and set audio channel count to 1

RecognitionConfig recognitionConfig =
RecognitionConfig.newBuilder()
.setEncoding(RecognitionConfig.AudioEncoding.LINEAR16)
.setLanguageCode(languageCode)
.setSampleRateHertz(16000)
**.setAudioChannelCount(1)**
.build();

StreamingRecognitionConfig streamingRecognitionConfig =
StreamingRecognitionConfig.newBuilder()
.setConfig(recognitionConfig)
.setInterimResults(true)
**.setEnableVoiceActivityEvents(true)
.setVoiceActivityTimeout(VoiceActivityTimeout.newBuilder()
.setSpeechStartTimeout(Duration.newBuilder().setSeconds(15L))
)**
.build();

## Describe the issue
After I receive the event SPEECH_ACTIVITY_BEGIN I get the CancelledException: Failed to read message.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.