Repository navigation
Error: Audio 'content' cannot be longer than 1 min. For long audio, use the 'uri' parameter to specify a file. #232
Description
Activity
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-nameor
node recognize.js async gs://your-bucket-name/your-file-nameKeep in mind the sample assumes
LINEAR16encoding and a sampleRate of16000. You need to modify those options if your file differs.@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:17So I have tried in this way using my CDN and a
WAVEfile 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.jsonbut 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
urionly works with Google Cloud Storage URIs, e.g.gs://your-bucket-name/your-file-name.If you use
https://yourcdn.com/your-file-namethen the library is actually downloading the file and passing it to the Speech API ascontent, not as auri.See the docs for
Speech#recognizeReacted by AliceGab@jmdobry Just to be clear, this means that passing a generic cdn uri will be limited to 1MB then?
1 minute, not 1 MB.
@jmdobry yes sorry
1 minutesof pcm audio.Yep
Reacted by narendeveloper1- addedtriage meI really want to be triaged.I really want to be triaged.🚨This issue needs some love.This issue needs some love.
on Apr 6, 2020 - added 2 commits that reference this issue
on Nov 10, 2022 - added 2 commits that reference this issue
on Nov 10, 2022 - added 2 commits that reference this issue
on Nov 18, 2022
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
uriparameter in the node cli?