Skip to content

Instantly share code, notes, and snippets.

@dutchiechris
Last active January 23, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dutchiechris/0e9ab01f1c603fb6a85541fa1da003d7 to your computer and use it in GitHub Desktop.
Save dutchiechris/0e9ab01f1c603fb6a85541fa1da003d7 to your computer and use it in GitHub Desktop.
Google Cloud Speech API test

Test steps for using the Google Cloud Platform Speech API on an existing recording

  1. Take an existing media file and ensure it's encoded in a supported format; check here
  • If you have an unsupported encoding you can use vlc to convert it (check the file menu) to be a WAV mono which is supported.
  1. Create a Cloud Storage bucket and put your audio file in there

  2. Go to Speech API longrunningrecognize docs and put a snippet like this where the gs:// stuff is your file in cloud storage:

{
  "audio": {
    "uri": "gs://20171228/lab-normal.wav"
  },
  "config": {
    "languageCode": "en"
  }
}
  1. You will get back an id and it will be queued for processing. You can check the status and get the resulting translation from the Speech API operation get API:
{
  "name": "1391643705764727398",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.speech.v1.LongRunningRecognizeMetadata",
    "progressPercent": 100,
    "startTime": "2018-01-23T09:21:23.344482Z",
    "lastUpdateTime": "2018-01-23T09:22:18.058485Z"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.speech.v1.LongRunningRecognizeResponse",
    "results": [
      {
        "alternatives": [
          {
            "transcript": "so who said engineer engineer someone who enables decision-making typically they do this by building data pipelines by ingesting data processing data building tools to analyze data building dashboards building machine learning models job is to enable decision-making within the company in a very systematic way and in order to be a good data engineer you need to know you needed to know both programming and statistics to a great deal of death but with the Advent of cloud services particularly the fully managed auto-scaling services on Google Cloud the amount of infrastructure that you need to know the amount of programming that you need to know has gotten a lot simpler at the same time the statistics Ron has also gotten a lot simpler you now have libraries that take care of a lot of the",
            "confidence": 0.96575004
          }
        ]
      },
      {
        "alternatives": [
          {
            "transcript": "the lower level programming that you have to do and a lot of the mathematical Concepts that you have to know to the extent that you can now program with data you can build statistical machine gun models a lot simpler when your building using these libraries in packages so what has happened is that overtime the amount of programming that you need you needed to know has gotten simplified the amount of Statistics that you need to know has gotten simplified and what that means is now that you can now look at somebody with skills of a data engineer who can now build this data Pipeline and go all the way to building statistical machine learning models so that's what we're going to be talking about in this in this sets of courses",
            "confidence": 0.95163494
          }
        ]
      }
    ],
    "totalBilledTime": "120s",
    "s3Condition": "longform"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment