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 — Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file. · Issue #232 · GoogleCloudPlatform/nodejs-docs-samples

Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file. #232

New issue
Copy link
New issue
Copy link
Closed
Closed
Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file.#232
Copy link
Labels
🚨This issue needs some love.triage meI really want to be triaged.

Description

@loretoparisi
loretoparisi
opened on Oct 11, 2016
Issue body actions

I get this error for audio samples longer than 60seconds:

Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file.

How to specify the uri parameter in the node cli?

Activity

  1. jmdobry commented on Oct 11, 2016

    @jmdobry
    jmdobry
    on Oct 11, 2016
    Member
    More actions

    You basically need to tell it to use a file you've uploaded to Google Cloud Storage.

    node recognize.js sync gs://your-bucket-name/your-file-name
    

    or

    node recognize.js async gs://your-bucket-name/your-file-name
    

    Keep in mind the sample assumes LINEAR16 encoding and a sampleRate of 16000. You need to modify those options if your file differs.

  2. loretoparisi commented on Oct 12, 2016

    @loretoparisi
    loretoparisi
    on Oct 12, 2016
    Author
    More actions

    @jmdobry I have tried as you said and the call seems to reply with the same error

    $ node recognize.js async "https://..."
    
    { Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file.
        at /Volumes/MacHDD2/Projects/MusiXmatch/AI/nodejs-docs-samples/speech/node_modules/grpc/src/node/src/client.js:417:17 code: 400, metadata: Metadata { _internal_repr: {} } }
    /Volumes/MacHDD2/Projects/MusiXmatch/AI/nodejs-docs-samples/utils/index.js:44
          throw err;
          ^
    
    Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file.
        at /Volumes/MacHDD2/Projects/nodejs-docs-samples/speech/node_modules/grpc/src/node/src/client.js:417:17
    

    So I have tried in this way using my CDN and a WAVE file 16K

    $ cat syn-request.json 
    {
            "config": {
                        "encoding": "WAVE",
                            "sampleRate": 16000,
                                "languageCode": "en-US"
                                },
                                "audio": {
                                            "uri": "https: //..."
    

    and

    $ export GCLOUD_PROJECT=my-project-id
    $ gcloud beta auth application-default login
    $ GCLOUD_ACCESSTOKEN=`echo gcloud auth print-access-token`
    

    to have an access token and then

    $ curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer $GCLOUD_ACCESSTOKEN" https://speech.googleapis.com/v1beta1/speech:syncrecognize -d @sync-request.json
    

    but I get

    {
      "error": {
        "code": 403,
        "message": "Google Cloud Speech API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
        "status": "PERMISSION_DENIED",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.Help",
            "links": [
              {
                "description": "Google developers console API activation",
                "url": "https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool"
              }
            ]
          }
        ]
      }
    }
    

    This error seems to be the same as referred in googleapis/google-cloud-ruby#706

  3. jmdobry commented on Oct 12, 2016

    @jmdobry
    jmdobry
    on Oct 12, 2016
    Member
    More actions

    uri only works with Google Cloud Storage URIs, e.g. gs://your-bucket-name/your-file-name.

    If you use https://yourcdn.com/your-file-name then the library is actually downloading the file and passing it to the Speech API as content, not as a uri.

    See the docs for Speech#recognize

    Reacted by AliceGab
  4. loretoparisi commented on Oct 12, 2016

    @loretoparisi
    loretoparisi
    on Oct 12, 2016
    Author
    More actions

    @jmdobry Just to be clear, this means that passing a generic cdn uri will be limited to 1MB then?

  5. jmdobry commented on Oct 13, 2016

    @jmdobry
    jmdobry
    on Oct 13, 2016
    Member
    More actions

    1 minute, not 1 MB.

  6. loretoparisi commented on Oct 13, 2016

    @loretoparisi
    loretoparisi
    on Oct 13, 2016
    Author
    More actions

    @jmdobry yes sorry 1 minutes of pcm audio.

  7. jmdobry commented on Nov 7, 2016

    @jmdobry
    jmdobry
    on Nov 7, 2016
    Member
    More actions

    Yep

    Reacted by narendeveloper1
  8. jmdobry
    closed this as completedon Nov 7, 2016
  9. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 6, 2020
  10. ivanmkc
    added a commit that references this issue on Nov 3, 2022

    chore: release 2.1.2 (#232)

    96dc293
  11. grayside
    added a commit that references this issue on Nov 8, 2022

    chore: release 2.1.2 (#232)

    d35d2a7
  12. NimJay
    added a commit that references this issue on Nov 9, 2022

    chore: release 2.1.1 (#232)

    2e9806b
  13. grayside
    added 2 commits that reference this issue on Nov 10, 2022

    chore: release 2.2.3 (#232)

    cf116b0

    chore: release 2.2.3 (#232)

    6a63509
  14. ace-n
    added 2 commits that reference this issue on Nov 10, 2022

    chore: release 2.2.3 (#232)

    ead65b5

    migrate code from googleapis/nodejs-cloudbuild (#2824)

    f03f09a
  15. NimJay
    added a commit that references this issue on Nov 11, 2022

    chore: release 1.5.2 (#232)

    a169be2
  16. ace-n
    added a commit that references this issue on Nov 11, 2022

    chore: release 1.5.2 (#232)

    8970842
  17. NimJay
    added 2 commits that reference this issue on Nov 18, 2022

    chore: release 2.2.0 (#232)

    dedf10b

    chore: release 2.2.0 (#232)

    c1e64f5
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

    🚨This issue needs some love.triage meI really want to be triaged.

    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.