Skip to content

Instantly share code, notes, and snippets.

@rowntreerob
Last active December 19, 2015 16:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowntreerob/849d6a40aec758505686 to your computer and use it in GitHub Desktop.
Save rowntreerob/849d6a40aec758505686 to your computer and use it in GitHub Desktop.
Curl to Google speech-api full-duplex
Input=./11.rec audio file with encoding/sampleRate as indicated in "Content-Type" httpHDR
Output the recognized speech is at the very bottom.
rob@ beacon$ curl -v "https://www.google.com/speech-api/full-duplex/v1/down?pair=3456123487654321" & curl -v -X POST "https://www.google.com/speech-api/full-duplex/v1/up?lang=en-US&lm=dictation&client=chromium&pair=3456123487654321&key=AFPMU" --header "Transfer-Encoding: chunked" --header "Content-Type: audio/x-flac; rate=22050" --data-binary @11.rec
[1] 4239
* About to connect() to www.google.com port 443 (#0)
* Trying 74.125.239.145...
* About to connect() to www.google.com port 443 (#0)
* Trying 74.125.239.48...
* connected
* Connected to www.google.com (74.125.239.145) port 443 (#0)
* connected
* Connected to www.google.com (74.125.239.48) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=www.google.com
* start date: 2013-06
* expire date: 2013-10
* subjectAltName: www.google.com matched
* issuer: C=US; O
* SSL certificate verify ok.
> GET /speech-api/full-duplex/v1/down?pair=3456123487654321 HTTP/1.1
> User-Agent: curl/7.28.1-DEV
> Host: www.google.com
> Accept: */*
>
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=www.google.com
* start date: 2013-06
* expire date: 2013-10
* subjectAltName: www.google.com matched
* issuer: C=US; O
* SSL certificate verify ok.
> POST /speech-api/full-duplex/v1/up?lang=en-US&lm=dictation&client=chromium&pair=3456123487654321&key=JAFPMU HTTP/1.1
> User-Agent: curl/7.28.1-DEV
> Host: www.google.com
> Accept: */*
> Transfer-Encoding: chunked
> Content-Type: audio/x-flac; rate=22050
> Expect: 100-continue
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Content-Disposition: attachment
< Cache-Control: no-transform
< X-Content-Type-Options: nosniff
< Pragma: no-cache
< Date: Tue, 18 Jun 2013 15:17:57 GMT
< Server: S3 v1.0
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Transfer-Encoding: chunked
<
{"result":[]}
* Done waiting for 100-continue
< HTTP/1.1 200 OK
< Date: Tue, 18 Jun 2013 15:18:02 GMT
< Content-Type: text/html
< Server: S3 v1.0
< Content-Length: 0
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
<
* Connection #0 to host www.google.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
rob@ beacon$ {"result":[{"alternative":[{"transcript":"hi how are you we have to go down to the store and see if we can get the groceries for this week so we can bring them back in the car","confidence":0.971865}],"final":true}],"result_index":0}
* Connection #0 to host www.google.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment