40

I'm playing with Google Speech Recognition API

After a successfully Getting started I'm trying to understand and made some changes in this first example but I don't know what "gs" protocol is and how to set it to use my own audio file.

sync-request.json

{
  "config": {
      "encoding":"FLAC",
      "sample_rate": 16000
  },
  "audio": {
      "uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
  }
}

I tried to change gs protocol to http protocol but doesn't work.

Thanks in advance.

Salvador Rueda
  • 615
  • 2
  • 6
  • 13

3 Answers3

54

You can access the file that you mention as follows:

https://storage.googleapis.com/cloud-samples-tests/speech/brooklyn.flac

So, if you create/upload your own file in Google Storage -- like I'm doing now while testing the same API you are using-- the "equivalence" is the following:

https://storage.googleapis.com/ 

translates to

gs://

and viceversa.

I have no idea why Google doesn't explain this clearly.

I hope this helps.

Hugo Nava Kopp
  • 2,358
  • 2
  • 21
  • 36
33

gs:// scheme is used for identifying resources stored in Google Cloud Storage.

Alexey Alexandrov
  • 2,401
  • 1
  • 18
  • 23
2

This is what Google's API docs says:

https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#audioencoding

URI that points to a file that contains audio data bytes as specified in RecognitionConfig. Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return google.rpc.Code.INVALID_ARGUMENT).

Prashant
  • 4,693
  • 9
  • 36
  • 56