All Speech-to-Text code samples

This page contains code samples for Speech-to-Text. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.

Asynchronously transcribe a local audio file

Perform asynchronous transcription on a local audio file.

Asynchronously transcribe an audio file in Cloud Storage

Perform asynchronous transcription on an audio file stored in Cloud Storage.

View in documentation

Asynchronously transcribe an audio file with time offsets

Perform asynchronous transcription including time offsets on an audio file stored in Cloud Storage.

View in documentation

Create an asynchronous speech file

Creates an asynchronous speech file.

Make an audio transcription request

Transcribe a local audio file synchronously.

Make an audio transcription request (beta)

Transcribe a local audio file synchronously.

Recognize a synchronization request

Loads the audio file from the disk into the request.

Streaming speech recognition

Reads and writes audio from a file.

Streaming speech recognition with punctuation

Performs streaming speech recognition on raw PCM audio data.

Synchronously recognize Cloud Storage

Creates a stub connected to the Speech-to-Text service.

Synchronously recognize words

Detects speech in the audio file.

Synchronously recognizes punctuation

Performs transcription with automatic punctuation on raw PCM audio data.

Synchronously transcribe a Cloud Storage file

Perform a synchronous transcription on an audio file stored in Cloud Storage

View in documentation

Synchronously transcribe a local file

Perform synchronous transcription on a local audio file.

Transcribe a file in Cloud Storage using a transcription model

Transcribe an audio file in Cloud Storage using a trained transcription model.

Transcribe a file in Cloud Storage with word-level confidence (beta)

Transcribe an audio file stored in Cloud Storage, returning the confidence level for each word.

View in documentation

Transcribe a file with word-level confidence (beta)

Transcribe an audio file, returning the confidence level for each word.

View in documentation

Transcribe a local file

Transcribe a short audio file.

Transcribe a local file using a transcription model

Transcribe a local audio file using a trained transcription model.

Transcribe a local file using an enhanced speech recognition (beta)

Transcribe a local audio file, where you specify an enhanced model.

Transcribe a local file using an enhanced speech recognition model

Transcribe a local audio file, where you specify an enhanced model.

Transcribe a local file with auto punctuation

Transcribe a local audio file, including auto punctuation.

View in documentation

Transcribe a local file with auto punctuation (beta)

Transcribe a local audio file, including auto punctuation.

Transcribe a local file with recognition metadata (beta)

Transcribe a local audio file, including recognition metadata in the response.

View in documentation

Transcribe a local multi-channel file

Transcribe a local audio file that includes more than one channel.

Transcribe a local multi-channel file (beta)

Transcribe a local audio file that includes more than one channel.

Transcribe a local multi-lingual file (beta)

Transcribe a local audio file that includes more than one language.

View in documentation

Transcribe a multi-channel file in Cloud Storage

Transcribe an audio file stored in Cloud Storage that includes more than one channel.

Transcribe a multi-channel file in Cloud Storage (beta)

Transcribe an audio file stored in Cloud Storage that includes more than one channel.

Transcribe a multi-lingual file in Cloud Storage (beta)

Transcribe an audio file stored in Cloud Storage that includes more than one language.

View in documentation

Transcribe a streaming audio feed

Transcribe a streaming audio feed from a microphone.

Transcribe a streaming feed on a local file

Transcribe a streaming audio feed from a microphone on a local file.

Transcribe streaming audio from a microphone

Transcribe streaming audio from a microphone.

Transcription of a file in Cloud Storage with diarization

Recognize multiple speakers in an audio file stored in Cloud Storage.

Transcription of a file in Cloud Storage with diarization (beta)

Recognize multiple speakers in an audio file stored in Cloud Storage.

Transcription of a local file with diarization

Recognize multiple speakers in a local audio file.

Transcription with diarization

Identify the different speakers in the audio sample.

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how Speech-to-Text performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Try Speech-to-Text free