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 — .flac file plays fine, but the speech/transcribe.py returns empty JSON output · Issue #640 · GoogleCloudPlatform/python-docs-samples

.flac file plays fine, but the speech/transcribe.py returns empty JSON output #640

New issue
Copy link
New issue
Copy link
Closed
Closed
.flac file plays fine, but the speech/transcribe.py returns empty JSON output#640
Copy link
Labels
ML

Description

@jcastill0
jcastill0
opened on Nov 7, 2016
Issue body actions

Using sox I created a .flac file.
I'm able to "play" the file which yields the following output of which I can also hear the audio:
% ./play Clip1.flac

Clip1.flac:

File Size: 356k Bit Rate: 161k
Encoding: FLAC Info: Processed by SoX
Channels: 1 @ 16-bit
Samplerate: 16000Hz
Replaygain: off
Duration: 00:00:17.64

In:100% 00:00:17.64 [00:00:00.00] Out:847k [ -====|====- ] Hd:2.8 Clip:0
Done.

When I try to use the transcribe.py script on the same file, it returns an empty {} JSON output

Activity

  1. jcastill0
    changed the title [-].flac file plays fine, but the transcribe.py returns empty JSON output[/-] [+].flac file plays fine, but the speech/transcribe.py returns empty JSON output[/+] on Nov 7, 2016
  2. puneith commented on Nov 7, 2016

    @puneith
    puneith
    on Nov 7, 2016
    Contributor
    More actions

    Are you using the one under grpc/ or api-client/ ?

  3. jcastill0 commented on Nov 7, 2016

    @jcastill0
    jcastill0
    on Nov 7, 2016
    Author
    More actions

    API-client

    On Sunday, November 6, 2016, Puneith Kaul [email protected] wrote:

    Are you using the one under grpc/ or api-client/ ?

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #640 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAtixfaWDf8zeb9Ym-vTqN2gIXgIijarks5q7q7BgaJpZM4Kqx9B
    .

  4. puneith commented on Nov 7, 2016

    @puneith
    puneith
    on Nov 7, 2016
    Contributor
    More actions

    That code uses LINEAR16 as input format and thats why you get empty json. You can change manually to either flac or send .raw file to this code. https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/api-client/transcribe.py#L65

  5. jcastill0
    added
    ML
    on Nov 7, 2016
  6. jcastill0 commented on Nov 8, 2016

    @jcastill0
    jcastill0
    on Nov 8, 2016
    Author
    More actions

    I tried to figure out how to generate a proper FLAC file, but I can'f find a way to do so with sox.
    I tried the following commands and although I can play them back with the play script, they still return an empty {} JSON output.
    First, using the macos version of sox. it doesn't take FLAC or LINEAR16 as an encoding parameter.
    So, I used the following commands to generate the .flac file:

    % ./sox data/Clip1.wav --rate 16k --bits 16 --channels 1 data/Clip1.flac
    ./sox WARN wav: wave header missing extended part of fmt chunk
    % ./play data/Clip1.flac

    data/Clip1.flac:

    File Size: 355k Bit Rate: 161k
    Encoding: FLAC Info: Processed by SoX
    Channels: 1 @ 16-bit
    Samplerate: 16000Hz
    Replaygain: off
    Duration: 00:00:17.64

    In:100% 00:00:17.64 [00:00:00.00] Out:847k [ -====|====- ] Hd:2.8 Clip:0

    Done.

    I also tried the following:
    % ./sox data/Clip1.wav --rate 16k --bits 16 --channels 1 --encoding mu-law data/Clip1a.flac
    % ./play data/Clip1a.flac

    data/Clip1a.flac:

    File Size: 356k Bit Rate: 161k
    Encoding: FLAC Info: Processed by SoX
    Channels: 1 @ 16-bit
    Samplerate: 16000Hz
    Replaygain: off
    Duration: 00:00:17.64

    In:100% 00:00:17.64 [00:00:00.00] Out:847k [ -====|====- ] Hd:2.8 Clip:0
    Done.

    Running the 2nd file on the transcribe.py yields the same resuls (empty JSON file)

  7. puneith commented on Nov 9, 2016

    @puneith
    puneith
    on Nov 9, 2016
    Contributor
    More actions

    Can you send me the audio file?

  8. jcastill0 commented on Nov 9, 2016

    @jcastill0
    jcastill0
    on Nov 9, 2016
    Author
    More actions

    I tried sending the files, but it was rejected.
    I put them up on a public folder on my Google Drive:
    https://drive.google.com/open?id=0B6DP39h3iDDvSDNDVkJ2QjNCTG8

    In there you will find 2 sets of files, both using Clip1.wav as a source.

    Clip1 used the following script to generate the flac file
    ./sox data/Clip1.wav --rate 16k --bits 16 --channels 1 data/Clip1.flac

    Clip1a used the following script to generate the flac file:
    ./sox data/Clip1.wav --rate 16k --bits 16 --channels 1 --encoding mu-law
    data/Clip1a.flac

    Let me know if you have any problems accessing the folder and the files
    within it

    On Tue, Nov 8, 2016 at 5:27 PM, Puneith Kaul [email protected]
    wrote:

    Can you send me the audio file?

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #640 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAtixXwYiU5sfbhOTlTKX1fjvm3ihiKQks5q8RNYgaJpZM4Kqx9B
    .

  9. puneith commented on Nov 10, 2016

    @puneith
    puneith
    on Nov 10, 2016
    Contributor
    More actions

    So, I do get some transcription (Both sync and async). Its not complete though, but thats a different issue. Are you not seeing this output?

    python api-client/transcribe_async.py Clip1.raw
    {"name": "7080391486607377985"}
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    Waiting for server processing...
    {"@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse", "results": [{"alternatives": [{"confidence": 0.82116348, "transcript": "no Mom's going to do the turkey I get there"}]}]}

    python api-client/transcribe.py input_files/Clip1.flac
    {"results": [{"alternatives": [{"confidence": 0.77390969, "transcript": "no Mom's going to do the turkey I get there"}]}]}

  10. theacodes commented on Feb 28, 2017

    @theacodes
    theacodes
    on Feb 28, 2017
    Contributor
    More actions

    (Closing due to inactivity, feel free to comment and we'll re-open)

  11. theacodes
    closed this as completedon Feb 28, 2017
  12. Linchin
    added a commit that references this issue on Aug 18, 2025

    chore(main): release 2.23.0 (#640)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ML

    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.