Chirp 3 Transcription: Enhanced multilingual accuracy

Try Chirp 3 in the Google Cloud console Try in Colab View notebook on GitHub

Chirp 3 is the latest generation of Google's multilingual Automatic Speech Recognition (ASR)-specific generative models, designed to meet user needs based on feedback and experience. Chirp 3 provides enhanced accuracy and speed beyond previous Chirp models and provides diarization and automatic language detection.

Model details

Chirp 3: Transcription, is exclusively available within the Speech-to-Text API V2.

Model identifiers

You can use Chirp 3: Transcription just like any other model by specifying the appropriate model identifier in your recognition request when using the API or the model name while in the Google Cloud console. Specify the appropriate identifier in your recognition.

Model Model identifier
Chirp 3 chirp_3

API methods

Not all recognition methods support the same language availability sets, because Chirp 3 is available in the Speech-to-Text API V2, it supports the following recognition methods:

API version API method Support
V2 Speech.StreamingRecognize (good for streaming and real-time audio) Supported
V2 Speech.Recognize (good for audio shorter than one minute) Supported
V2 Speech.BatchRecognize (good for long audio 1 minute to 1 hour in general, but up to 20 minutes with word-level timestamp enabled) Supported

Regional availability

The chirp_3 model requires a regional or multi-regional API endpoint, such as us-speech.googleapis.com. It isn't available on the global endpoint.

For supported locations, locales, and features, see Cloud Speech-to-Text V2 supported languages and filter by chirp_3. You can also query the Locations API as described in Regional availability.

Language availability for transcription

Chirp 3 supports transcription in StreamingRecognize, Recognize, and BatchRecognize. For the current list of supported languages, see Cloud Speech-to-Text V2 supported languages and filter by the chirp_3 model. For per-feature launch stages, query the Locations API as described in Regional availability.

Language availability for diarization

Chirp 3 supports speaker diarization in Recognize and BatchRecognize, but not in StreamingRecognize. Diarization also works with auto language detection if the spoken language supports diarization. For supported locales, see Cloud Speech-to-Text V2 supported languages.

Feature support and limitations

Chirp 3 supports the following features:

Feature Description Launch stage
Automatic punctuation Automatically generated by the model and can be optionally disabled. GA
Automatic capitalization Automatically generated by the model and can be optionally disabled. GA
Utterance-level timestamps Automatically generated by the model. Available only in Speech.StreamingRecognize GA
Speaker diarization Automatically identifies the different speakers in a single-channel audio sample. Available in Speech.Recognize and Speech.BatchRecognize. GA
Speech adaptation (biasing) Provides prompt-based phrase hints to improve recognition accuracy for specific terms or proper nouns. See Improve accuracy with model adaptation. GA
Word-level timestamps Generates timestamps for each transcribed word when enabled, which might slightly reduce transcription accuracy. Available in Speech.Recognize and Speech.BatchRecognize, and unsupported in Speech.StreamingRecognize. GA
Language-agnostic audio transcription Automatically infers and transcribes in the most prevalent language. GA
Custom prompt Provides customized transcription formatting instructions to the model. Preview

Chirp 3 doesn't support the following features:

Feature Description
Word-level confidence scores The API returns a value, but it isn't truly a confidence score.

Transcribe using Chirp 3

Discover how to use Chirp 3 for transcription tasks.

Perform streaming speech recognition

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_streaming_chirp3(
   audio_file: str
) -> cloud_speech.StreamingRecognizeResponse:
   """Transcribes audio from audio file stream using the Chirp 3 model of Google Cloud Speech-to-Text v2 API.

   Args:
       audio_file (str): Path to the local audio file to be transcribed.
           Example: "resources/audio.wav"

   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API V2 containing
       the transcription results.
   """

   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   # Reads a file as bytes
   with open(audio_file, "rb") as f:
       content = f.read()

   # In practice, stream should be a generator yielding chunks of audio data
   chunk_length = len(content) // 5
   stream = [
       content[start : start + chunk_length]
       for start in range(0, len(content), chunk_length)
   ]
   audio_requests = (
       cloud_speech.StreamingRecognizeRequest(audio=audio) for audio in stream
   )

   recognition_config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US"],
       model="chirp_3",
   )
   streaming_config = cloud_speech.StreamingRecognitionConfig(
       config=recognition_config
   )
   config_request = cloud_speech.StreamingRecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       streaming_config=streaming_config,
   )

   def requests(config: cloud_speech.RecognitionConfig, audio: list) -> list:
       yield config
       yield from audio

   # Transcribes the audio into text
   responses_iterator = client.streaming_recognize(
       requests=requests(config_request, audio_requests)
   )
   responses = []
   for response in responses_iterator:
       responses.append(response)
       for result in response.results:
           print(f"Transcript: {result.alternatives[0].transcript}")

   return responses

Perform synchronous speech recognition

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_sync_chirp3(
   audio_file: str
) -> cloud_speech.RecognizeResponse:
   """Transcribes an audio file using the Chirp 3 model of Google Cloud Speech-to-Text V2 API.
   Args:
       audio_file (str): Path to the local audio file to be transcribed.
           Example: "resources/audio.wav"
   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
       the transcription results.
   """

   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   # Reads a file as bytes
   with open(audio_file, "rb") as f:
       audio_content = f.read()

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US"],
       model="chirp_3",
   )

   request = cloud_speech.RecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       content=audio_content,
   )

   # Transcribes the audio into text
   response = client.recognize(request=request)

   for result in response.results:
       print(f"Transcript: {result.alternatives[0].transcript}")

   return response

Perform batch speech recognition

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_batch_3(
   audio_uri: str,
) -> cloud_speech.BatchRecognizeResults:
   """Transcribes an audio file from a Google Cloud Storage URI using the Chirp 3 model of Google Cloud Speech-to-Text v2 API.
   Args:
       audio_uri (str): The Google Cloud Storage URI of the input audio file.
           E.g., gs://[BUCKET]/[FILE]
   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
       the transcription results.
   """

   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US"],
       model="chirp_3",
   )

   file_metadata = cloud_speech.BatchRecognizeFileMetadata(uri=audio_uri)

   request = cloud_speech.BatchRecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       files=[file_metadata],
       recognition_output_config=cloud_speech.RecognitionOutputConfig(
           inline_response_config=cloud_speech.InlineOutputConfig(),
       ),
   )

   # Transcribes the audio into text
   operation = client.batch_recognize(request=request)

   print("Waiting for operation to complete...")
   response = operation.result(timeout=120)

   for result in response.results[audio_uri].transcript.results:
       print(f"Transcript: {result.alternatives[0].transcript}")

   return response.results[audio_uri].transcript

Use Chirp 3 features

Explore how you can use the latest features, with code examples:

Perform a language-agnostic transcription

Chirp 3, can automatically identify and transcribe in the dominant language spoken in the audio which is essential for multilingual applications. To achieve this set language_codes=["auto"] as indicated in the code example:

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_sync_chirp3_auto_detect_language(
   audio_file: str
) -> cloud_speech.RecognizeResponse:
   """Transcribes an audio file and auto-detect spoken language using Chirp 3.
   Please see https://cloud.google.com/speech-to-text/docs/encoding for more
   information on which audio encodings are supported.
   Args:
       audio_file (str): Path to the local audio file to be transcribed.
           Example: "resources/audio.wav"
   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
       the transcription results.
   """
   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   # Reads a file as bytes
   with open(audio_file, "rb") as f:
       audio_content = f.read()

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["auto"],  # Set language code to auto to detect language.
       model="chirp_3",
   )

   request = cloud_speech.RecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       content=audio_content,
   )

   # Transcribes the audio into text
   response = client.recognize(request=request)

   for result in response.results:
       print(f"Transcript: {result.alternatives[0].transcript}")
       print(f"Detected Language: {result.language_code}")

   return response

Perform a language-restricted transcription

Chirp 3 can automatically identify and transcribe the dominant language in an audio file. You can also condition it on specific locales you expect, for example: ["en-US", "fr-FR"], which would focus the model's resources on the most probable languages for more reliable results, as demonstrated in the code example:

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_sync_3_auto_detect_language(
   audio_file: str
) -> cloud_speech.RecognizeResponse:
   """Transcribes an audio file and auto-detect spoken language using Chirp 3.
   Please see https://cloud.google.com/speech-to-text/docs/encoding for more
   information on which audio encodings are supported.
   Args:
       audio_file (str): Path to the local audio file to be transcribed.
           Example: "resources/audio.wav"
   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
       the transcription results.
   """
   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   # Reads a file as bytes
   with open(audio_file, "rb") as f:
       audio_content = f.read()

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US", "fr-FR"],  # Set language codes of the expected spoken locales
       model="chirp_3",
   )

   request = cloud_speech.RecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       content=audio_content,
   )

   # Transcribes the audio into text
   response = client.recognize(request=request)

   for result in response.results:
       print(f"Transcript: {result.alternatives[0].transcript}")
       print(f"Detected Language: {result.language_code}")

   return response

Perform transcription and speaker diarization

Use Chirp 3 for transcription and diarization tasks.

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_batch_chirp3(
   audio_uri: str,
) -> cloud_speech.BatchRecognizeResults:
   """Transcribes an audio file from a Google Cloud Storage URI using the Chirp 3 model of Google Cloud Speech-to-Text V2 API.
   Args:
       audio_uri (str): The Google Cloud Storage URI of the input
         audio file. E.g., gs://[BUCKET]/[FILE]
   Returns:
       cloud_speech.RecognizeResponse: The response from the
         Speech-to-Text API containing the transcription results.
   """

   # Instantiates a client.
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US"],  # Use "auto" to detect language.
       model="chirp_3",
       features=cloud_speech.RecognitionFeatures(
           # Enable diarization by setting empty diarization configuration.
           diarization_config=cloud_speech.SpeakerDiarizationConfig(),
       ),
   )

   file_metadata = cloud_speech.BatchRecognizeFileMetadata(uri=audio_uri)

   request = cloud_speech.BatchRecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       files=[file_metadata],
       recognition_output_config=cloud_speech.RecognitionOutputConfig(
           inline_response_config=cloud_speech.InlineOutputConfig(),
       ),
   )

   # Creates audio transcription job.
   operation = client.batch_recognize(request=request)

   print("Waiting for transcription job to complete...")
   response = operation.result(timeout=120)

   for result in response.results[audio_uri].transcript.results:
       print(f"Transcript: {result.alternatives[0].transcript}")
       print(f"Detected Language: {result.language_code}")
       print(f"Speakers per word: {result.alternatives[0].words}")

   return response.results[audio_uri].transcript

Improve accuracy with model adaptation

Chirp 3 supports model adaptation using PhraseSet resources to improve recognition of domain-specific terms, proper nouns, and acronyms.

Because Chirp 3 applies adaptation phrases through the model prompt, the following constraints apply:

  • A request can include up to 1,000 total phrases across all inline and referenced PhraseSet resources. Exceeding 1,000 phrases returns an INVALID_ARGUMENT error.
  • Chirp 3 ignores numeric boost values on PhraseSet and Phrase entries (if provided, values must still be in the valid 0 to 20 range).
  • Large, untargeted PhraseSet lists can degrade general accuracy and increase unintended transcriptions during silence or noise. Keep lists focused on rare terms that appear in your audio.

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_sync_chirp3_model_adaptation(
   audio_file: str
) -> cloud_speech.RecognizeResponse:
   """Transcribes an audio file using the Chirp 3 model with adaptation, improving accuracy for specific audio characteristics or vocabulary.
   Args:
       audio_file (str): Path to the local audio file to be transcribed.
           Example: "resources/audio.wav"
   Returns:
       cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
       the transcription results.
   """

   # Instantiates a client
   client = SpeechClient(
       client_options=ClientOptions(
           api_endpoint=f"{REGION}-speech.googleapis.com",
       )
   )

   # Reads a file as bytes
   with open(audio_file, "rb") as f:
       audio_content = f.read()

   config = cloud_speech.RecognitionConfig(
       auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
       language_codes=["en-US"],
       model="chirp_3",
       # Use model adaptation
       adaptation=cloud_speech.SpeechAdaptation(
         phrase_sets=[
             cloud_speech.SpeechAdaptation.AdaptationPhraseSet(
                 inline_phrase_set=cloud_speech.PhraseSet(phrases=[
                   {
                       "value": "alphabet",
                   },
                   {
                         "value": "cell phone service",
                   }
                 ])
             )
         ]
       )
   )

   request = cloud_speech.RecognizeRequest(
       recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
       config=config,
       content=audio_content,
   )

   # Transcribes the audio into text
   response = client.recognize(request=request)

   for result in response.results:
       print(f"Transcript: {result.alternatives[0].transcript}")

   return response

Use custom prompt to format the transcription

Chirp 3 accepts a custom prompt as the formatting instructions to the model.

Python

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
REGION = "us"

def transcribe_sync_chirp3_custom_prompt(
 audio_file: str,
 custom_prompt: str,
 ) -> cloud_speech.RecognizeResponse:
     """Transcribes an audio file and auto-detect spoken language using Chirp 3.
     Args:
         audio_file (str): Path to the local audio file to be transcribed.
             Example: "resources/audio.wav"
         custom_prompt: the customized formatting instructions.
             Example: "Capitalize the following special words: GOOGLE, CHIRP."
             Example: "For dates don't use the 'December 23rd, 1939' format!
             But strictly use the '12/23/1939' format."
     Returns:
         cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
         the transcription results.
     """
     # Instantiates a client
     client = SpeechClient(
         client_options=ClientOptions(
             api_endpoint=f"{REGION}-speech.googleapis.com",
         )
     )

     # Reads a file as bytes
     with open(audio_file, "rb") as f:
         audio_content = f.read()

     config = cloud_speech.RecognitionConfig(
         auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
         language_codes=["en-US"],
         model="chirp_3",
         features=cloud_speech.RecognitionFeatures(
             custom_prompt_config=cloud_speech.CustomPromptConfig(
                 custom_prompt= custom_prompt,
             )
         ),
     )

     request = cloud_speech.RecognizeRequest(
         recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
         config=config,
         content=audio_content,
     )

     # Transcribes the audio into text
     response = client.recognize(request=request)
     print(f"Prompt used: {response.metadata.prompt}")

     for result in response.results:
         print(f"Transcript: {result.alternatives[0].transcript}")
         print(f"Detected Language: {result.language_code}")

     return response

Enable denoiser

Chirp 3 can reduce background noise during streaming transcription when you configure denoiser_config on RecognitionConfig:

  • Set denoise_audio=true to reduce non-speech background noise such as music, rain, or traffic.
  • Set snr_threshold to a value greater than 0.0 to skip audio segments with a low signal-to-noise ratio. A value of 0.0 disables threshold filtering.

Python

 import os

 from google.api_core.client_options import ClientOptions
 from google.cloud.speech_v2 import SpeechClient
 from google.cloud.speech_v2.types import cloud_speech

 PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
 REGION = "us"

 def transcribe_streaming_chirp3_denoiser(
     audio_file: str,
 ) -> list[cloud_speech.StreamingRecognizeResponse]:
     """Streams an audio file to Chirp 3 with the denoiser enabled."""
     client = SpeechClient(
         client_options=ClientOptions(
             api_endpoint=f"{REGION}-speech.googleapis.com",
         )
     )

     recognition_config = cloud_speech.RecognitionConfig(
         auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
         language_codes=["en-US"],
         model="chirp_3",
         denoiser_config=cloud_speech.DenoiserConfig(
             denoise_audio=True,
             snr_threshold=0.0,
         ),
     )
     config_request = cloud_speech.StreamingRecognizeRequest(
         recognizer=f"projects/{PROJECT_ID}/locations/{REGION}/recognizers/_",
         streaming_config=cloud_speech.StreamingRecognitionConfig(
             config=recognition_config,
         ),
     )

     def requests():
         yield config_request
         with open(audio_file, "rb") as f:
             while chunk := f.read(4096):
                 yield cloud_speech.StreamingRecognizeRequest(audio=chunk)

     responses_iterator = client.streaming_recognize(requests=requests())
     responses = []
     for response in responses_iterator:
         responses.append(response)
         for result in response.results:
             if result.is_final:
                 print(f"Transcript: {result.alternatives[0].transcript}")
     return responses

Adjust endpointing sensitivity

The Cloud Speech-to-Text API lets you control the trade-off between latency and accuracy for streaming and real-time applications for Chirp 3. By default, the recognition model waits for a brief period of silence after speech is detected to ensure that a user has finished a complete sentence or phrase. This helps to ensure the highest accuracy but introduces a small delay in the final response.

endpointing_sensitivity can be adjusted for time-sensitive applications like voice commands or voice bots to finalize results more quickly.

Sensitivity levels

Endpointing sensitivity can be configured to one of the following levels based on the use case:

  • ENDPOINTING_SENSITIVITY_STANDARD (default): The standard setting that balances latency and accuracy. It's optimized for most use cases, including long-form dictation and natural conversation. The model waits to help ensure the utterance is complete before finalizing the result.

  • ENDPOINTING_SENSITIVITY_SHORT: Optimized for short utterances, such as single sentences or commands, such as "Remind me to call the dentist tomorrow". This setting reduces the wait time after speech is detected, which provides a faster response than the standard setting while maintaining reasonable sentence-level accuracy.

  • ENDPOINTING_SENSITIVITY_SUPERSHORT: Optimized for very short commands or single words, such as "Yes", "No", or "Stop". This setting offers the lowest latency and finalizes the result immediately upon detecting the end of speech. It is recommended only for applications where speed is critical and utterances are expected to be brief.

Python

import time
from google.api_core.client_options import ClientOptions
from google.cloud import speech_v2

RATE = 16000

def transcribe_streaming(
    project_id: str,
    audio_file: str,
    # 'us' is a multi-region that currently supports the 'chirp_3' model.
    # Other valid regions include 'eu' or specific regions like 'asia-southeast1'.
    region: str = "us"
):
    recognizer_path = f"projects/{project_id}/locations/{region}/recognizers/_"

    # Setup client with the correct regional endpoint
    client = speech_v2.SpeechClient(
        client_options=ClientOptions(
            api_endpoint=f"{region}-speech.googleapis.com",
            quota_project_id=project_id
        )
    )

    recognition_config_obj = speech_v2.RecognitionConfig(
        explicit_decoding_config=speech_v2.ExplicitDecodingConfig(
            encoding=speech_v2.ExplicitDecodingConfig.AudioEncoding.LINEAR16,
            sample_rate_hertz=RATE,
            audio_channel_count=1,
        ),
        language_codes=["en-US"],
        model="chirp_3",
        features=speech_v2.RecognitionFeatures(
            enable_automatic_punctuation=True,
        ),
    )

    config_request = speech_v2.StreamingRecognizeRequest(
        recognizer=recognizer_path,
        streaming_config=speech_v2.StreamingRecognitionConfig(
            config=recognition_config_obj,
            streaming_features=speech_v2.StreamingRecognitionFeatures(
                interim_results=False,
                enable_voice_activity_events=True,
                # Set sensitivity to SUPERSHORT (Low Latency)
                endpointing_sensitivity=speech_v2.StreamingRecognitionFeatures.EndpointingSensitivity.ENDPOINTING_SENSITIVITY_SUPERSHORT,
            ),
        )
    )

    def request_generator():
        yield config_request
        with open(audio_file, "rb") as f:
            while chunk := f.read(4096):
                yield speech_v2.StreamingRecognizeRequest(audio=chunk)

    start_time = time.time()

    print(f"Streaming audio to {region}-speech.googleapis.com...")

    for response in client.streaming_recognize(requests=request_generator()):
        if response.results:
            for result in response.results:
                if result.is_final:
                    print(f"Transcript: {result.alternatives[0].transcript}")
                    print(f"Time taken: {time.time() - start_time:.3f}s")

def main() -> None:
    # TODO: Replace with your Project ID and File Path
    PROJECT_ID = "your-project-id"
    AUDIO_FILE_PATH = "path/to/your/audio.wav"

    transcribe_streaming(
        project_id=PROJECT_ID,
        audio_file=AUDIO_FILE_PATH
    )

if __name__ == "__main__":
    main()

Use Chirp 3 in the Google Cloud console

  1. Sign up for a Google Cloud account, and create a project.
  2. Go to Speech in the Google Cloud console.
  3. If the API isn't enabled, enable the API.
  4. Make sure that you have an STT console Workspace. If you don't have a workspace, you must create a workspace.

    1. Go to the transcriptions page, and click New Transcription.

    2. Open the Workspace drop-down and click New Workspace to create a workspace for transcription.

    3. From the Create a new workspace navigation sidebar, click Browse.

    4. Click to create a new bucket.

    5. Enter a name for your bucket and click Continue.

    6. Click Create to create your Cloud Storage bucket.

    7. After the bucket is created, click Select to select your bucket for use.

    8. Click Create to finish creating your workspace for the Speech-to-Text API V2 console.

  5. Perform a transcription on your actual audio.

    The Speech-to-Text transcription creation page, showing file selection or upload.
    The Speech-to-Text transcription creation page, showing file selection or upload.

    From the New Transcription page, select your audio file through either upload (Local upload) or specifying an existing Cloud Storage file (Cloud storage).

  6. Click Continue to move to the Transcription options.

    1. Select the Spoken language that you plan to use for recognition with Chirp from your previously created recognizer.

    2. In the model drop-down, select chirp_3.

    3. In the Recognizer drop-down, select your newly created recognizer.

    4. Click Submit to run your first recognition request using chirp_3.

  7. View your Chirp 3 transcription result.

    1. From the Transcriptions page, click the name of the transcription to view its result.

    2. In the Transcription details page, view your transcription result, and optionally playback the audio in the browser.

What's next

  • Learn how to transcribe short audio files.
  • Learn how to transcribe streaming audio.
  • Learn how to transcribe long audio files.
  • For best performance, accuracy, and other tips, see the best practices documentation.