GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Audio data is being streamed too fast... Cloud Speech API Sample · Issue #1534 · googleapis/google-cloud-java

Audio data is being streamed too fast... Cloud Speech API Sample #1534

New issue
Copy link
New issue
Copy link
Closed
Closed
Audio data is being streamed too fast... Cloud Speech API Sample#1534
Copy link
Assignees
garrettjonesgoogle
Labels
api: speechIssues related to the Speech-to-Text API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@WrathOfFlame
WrathOfFlame
opened on Jan 13, 2017
Issue body actions

Keep getting the following error for grpc/StreamingRecognizeClient sample (a bit modified to access web-camera mike), I tried different sample rate values, but all of my attempts failed Any suggestions?

update. Error log:

ERROR - recognize failed: {0}
io.grpc.StatusRuntimeException: OUT_OF_RANGE: Audio data is being streamed too fast. Please stream audio data approximately at real time.
at io.grpc.Status.asRuntimeException(Status.java:545)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:481)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:398)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:513)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Activity

  1. garrettjonesgoogle commented on Jan 13, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on Jan 13, 2017
    Contributor
    More actions

    Your issue seems to be missing the actual error, could you add it?

  2. garrettjonesgoogle
    added
    api: speechIssues related to the Speech-to-Text API.
    on Jan 13, 2017
  3. WrathOfFlame commented on Jan 14, 2017

    @WrathOfFlame
    WrathOfFlame
    on Jan 14, 2017
    Author
    More actions

    I should have said that the exception is raised even if the input data was recognized and actual response contains transcripts with the phrases expected

  4. binhndicts commented on Jun 2, 2017

    @binhndicts
    binhndicts
    on Jun 2, 2017
    More actions

    I got the same problem when trying to restart listening. Stop audio listening + streaming and start them after 2s. After the steps, the error occur continuously

  5. tcoffee-google
    added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jun 12, 2017
  6. anthmgoogle
    assigned
    garrettjonesgoogle
    on Nov 9, 2017
  7. anthmgoogle commented on Nov 9, 2017

    @anthmgoogle
    anthmgoogle
    on Nov 9, 2017
    More actions

    May be a config or code-gen issue.

  8. anthmgoogle
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Nov 9, 2017
  9. garrettjonesgoogle
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Dec 21, 2017
  10. pongad commented on Jan 25, 2018

    @pongad
    pongad
    on Jan 25, 2018
    Contributor
    More actions

    I don't think either codegen or bitrate is the problem. I believe the sample is we're sending the bytes too fast.

    I created a reproduction below, where I throttle the sound upload (search for "throttle"). If we comment out that line, the stream fails with the "stream too fast" error. If I leave the line there, everything seems to work as intended.

    It is strange that this could be happening with a microphone though. I think there are a couple of suspects:

    • Perhaps you set the sample rate in the config wrong. If the mic records at 10,000 hz and you set 5,000, the API will probably think you're sending data twice as fast as you should.
    • Could there be issues will excessive buffering? Eg, we're trying to send data for many seconds as once?

    Due to age, I'll close this issue for now. I think it's unlikely that it's a client problem. If the issue persists, please feel free to reopen.

      public static void main(String[] args) throws Exception {
        int sampleRate = 44100;
        int bytesPerSample = 2;
        ByteString speech =
            ByteString.readFrom(
                new FileInputStream("path/to/audio.flac"));
    
        try (SpeechClient speechClient = SpeechClient.create()) {
          ApiStreamObserver<StreamingRecognizeResponse> responseObserver =
              new ApiStreamObserver<StreamingRecognizeResponse>() {
                @Override
                public void onNext(StreamingRecognizeResponse response) {
                  System.out.println(response);
                }
    
                @Override
                public void onError(Throwable t) {
                  System.out.println("ERROR: " + t);
                  System.exit(1);
                }
    
                @Override
                public void onCompleted() {
                  System.out.println("COMPLETED");
                }
              };
          ApiStreamObserver<StreamingRecognizeRequest> requestObserver =
              speechClient.streamingRecognizeCallable().bidiStreamingCall(responseObserver);
          requestObserver.onNext(
              StreamingRecognizeRequest.newBuilder()
                  .setStreamingConfig(
                      StreamingRecognitionConfig.newBuilder()
                          .setConfig(
                              RecognitionConfig.newBuilder()
                                  .setEncoding(AudioEncoding.FLAC)
                                  .setSampleRateHertz(sampleRate)
                                  .setLanguageCode("en-US")
                                  .build())
                          .build())
                  .build());
    
          int step = sampleRate * bytesPerSample;
          for (int i = 0; i < speech.size(); i += step) {
            requestObserver.onNext(
                StreamingRecognizeRequest.newBuilder()
                    .setAudioContent(speech.substring(i, Math.min(i + step, speech.size())))
                    .build());
            Thread.sleep(1000); // throttle so we send only 1 sec of sound per sec.
          }
          for (; ; ) Thread.sleep(1000); // Don't let main exit, or the JVM will close.
        }
      }
  11. pongad
    closed this as completedon Jan 25, 2018
  12. github-actions
    added a commit that references this issue on Oct 10, 2022

    chore(deps): update dependency com.google.cloud:google-cloud-bigquery…

    21ead41
  13. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore(deps): update dependency com.google.cloud:google-cloud-logging …

    9de8577
  14. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(main): release 0.132.18-alpha (#1534)

    de8a230
  15. chingor13
    added a commit that references this issue on Feb 24, 2026

    feat: service sccount to service account impersonation to support uni…

    c498ccf
  16. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore(deps): update dependency com.google.cloud:google-cloud-logging …

    d85072a
  17. chingor13
    added a commit that references this issue on Mar 12, 2026

    feat: service sccount to service account impersonation to support uni…

    ea6bf5c
  18. lqiu96
    added a commit that references this issue on Mar 20, 2026

    chore(main): release 0.132.18-alpha (#1534)

    8e8142b
  19. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(main): release 2.16.1 (googleapis#1534)

    a2f1267
  20. suztomo
    added a commit that references this issue on Mar 30, 2026

    chore(deps): update dependency com.google.cloud:libraries-bom to v26.…

    876ca11
  21. lqiu96
    added a commit that references this issue on Apr 1, 2026

    chore(deps): update dependency com.google.cloud:libraries-bom to v26.…

    34de0b0
  22. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore(main): release 1.123.8-SNAPSHOT (#1534)

    ac690d0

    chore(main): release 1.123.8-SNAPSHOT (#1534)

    a1c31ff
  23. benjaminp
    added a commit that references this issue on Jul 13, 2026

    chore: update native image checks to use graalvm-22.3.0 (googleapis#1534

    9c8d339
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @garrettjonesgoogle
    garrettjonesgoogle

Labels

api: speechIssues related to the Speech-to-Text API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.