Service Client: Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::SpeechTranslationServiceClient

Client stub representing the remote SpeechTranslationService gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to mediatranslation.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation - Compiled Protocol Buffers messages for google/cloud/mediatranslation/v1beta1/media_translation.proto

SYNOPSIS

use Google::Cloud::Mediatranslation::V1beta1::MediaTranslation;

my $msg = Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::TranslateSpeechConfig->new({
    audio_encoding => $audio_encoding,
    source_language_code => $source_language_code,
    target_language_code => $target_language_code,
    sample_rate_hertz => $sample_rate_hertz,
});

# Read or update a field
my $val = $msg->audio_encoding();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::TranslateSpeechConfig->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/mediatranslation/v1beta1/media_translation.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::TranslateSpeechConfig

Provides information to the speech translation that specifies how to process the request.

Inherits from Protobuf::Message.

Accessors

  • $msg->audio_encoding() / $msg->audio_encoding($value)

    Type: String

    Required. Encoding of audio data. Supported formats:

    - `linear16`

    Uncompressed 16-bit signed little-endian samples (Linear PCM).

    - `flac`

    `flac` (Free Lossless Audio Codec) is the recommended encoding
    because it is lossless--therefore recognition is not compromised--and
    requires only about half the bandwidth of `linear16`.

    - `mulaw`

    8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.

    - `amr`

    Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.

    - `amr-wb`

    Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.

    - `ogg-opus`

    Opus encoded audio frames in [Ogg](https://wikipedia.org/wiki/Ogg)
    container. `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000,
    or 48000.

    - `mp3`

    MP3 audio. Support all standard MP3 bitrates (which range from 32-320
    kbps). When using this encoding, `sample_rate_hertz` has to match the
    sample rate of the file being used.
  • $msg->source_language_code() / $msg->source_language_code($value)

    Type: String

    Required. Source language code (BCP-47) of the input audio.

  • $msg->target_language_code() / $msg->target_language_code($value)

    Type: String

    Required. Target language code (BCP-47) of the output.

  • $msg->sample_rate_hertz() / $msg->sample_rate_hertz($value)

    Type: Int32

    Optional. Sample rate in Hertz of the audio data. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

  • $msg->model() / $msg->model($value)

    Type: String

    Optional. `google-provided-model/video` and `google-provided-model/enhanced-phone-call` are premium models. `google-provided-model/phone-call` is not premium model.

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::StreamingTranslateSpeechConfig

Config used for streaming translation.

Inherits from Protobuf::Message.

Accessors

  • $msg->audio_config() / $msg->audio_config($value)

    Type: Message (Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::TranslateSpeechConfig)

    Required. The common config for all the following audio contents.

  • $msg->single_utterance() / $msg->single_utterance($value)

    Type: Bool

    Optional. If `false` or omitted, the system performs continuous translation (continuing to wait for and process audio even if the user pauses speaking) until the client closes the input stream (gRPC API) or until the maximum time limit has been reached. May return multiple `StreamingTranslateSpeechResult`s with the `is_final` flag set to `true`.

    If `true`, the speech translator will detect a single spoken utterance. When it detects that the user has paused or stopped speaking, it will return an `END_OF_SINGLE_UTTERANCE` event and cease translation. When the client receives 'END_OF_SINGLE_UTTERANCE' event, the client should stop sending the requests. However, clients should keep receiving remaining responses until the stream is terminated. To construct the complete sentence in a streaming way, one should override (if 'is_final' of previous response is false), or append (if 'is_final' of previous response is true).

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::StreamingTranslateSpeechRequest

The top-level message sent by the client for the `StreamingTranslateSpeech` method. Multiple `StreamingTranslateSpeechRequest` messages are sent. The first message must contain a `streaming_config` message and must not contain `audio_content` data. All subsequent messages must contain `audio_content` data and must not contain a `streaming_config` message.

Inherits from Protobuf::Message.

Accessors

  • $msg->streaming_config() / $msg->streaming_config($value)

    Type: Message (Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::StreamingTranslateSpeechConfig)

    Provides information to the recognizer that specifies how to process the request. The first `StreamingTranslateSpeechRequest` message must contain a `streaming_config` message.

  • $msg->audio_content() / $msg->audio_content($value)

    Type: Bytes

    The audio data to be translated. Sequential chunks of audio data are sent in sequential `StreamingTranslateSpeechRequest` messages. The first `StreamingTranslateSpeechRequest` message must not contain `audio_content` data and all subsequent `StreamingTranslateSpeechRequest` messages must contain `audio_content` data. The audio bytes must be encoded as specified in `StreamingTranslateSpeechConfig`. Note: as with all bytes fields, protobuffers use a pure binary representation (not base64).

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::StreamingTranslateSpeechResult

A streaming speech translation result corresponding to a portion of the audio that is currently being processed.

Inherits from Protobuf::Message.

Accessors

Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::StreamingTranslateSpeechResponse

A streaming speech translation response corresponding to a portion of the audio currently processed.

Inherits from Protobuf::Message.

Accessors

Enum: StreamingTranslateSpeechResponse::SpeechEventType

  • SPEECH_EVENT_TYPE_UNSPECIFIED => 0

  • END_OF_SINGLE_UTTERANCE => 1

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Mediatranslation::V1beta1::MediaTranslation::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.