# Google Cloud Media Translation V1beta1 Client - Class TranslateSpeechConfig (0.6.2)

0.6.2 (latest) 0.6.1 0.5.2 0.4.5 0.3.3 0.2.12

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

Reference documentation and code samples for the Google Cloud Media Translation V1beta1 Client class TranslateSpeechConfig.

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

Generated from protobuf message `google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig`

## Namespace

Google \\ Cloud \\ MediaTranslation \\ V1beta1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ audio_encoding` | `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. |
| `↳ source_language_code` | `string` Required. Source language code (BCP-47) of the input audio. |
| `↳ target_language_code` | `string` Required. Target language code (BCP-47) of the output. |
| `↳ sample_rate_hertz` | `int` 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). |
| `↳ model` | `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. |

### getAudioEncoding

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAudioEncoding

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSourceLanguageCode

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSourceLanguageCode

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTargetLanguageCode

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setTargetLanguageCode

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSampleRateHertz

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).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setSampleRateHertz

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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getModel

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

`google-provided-model/phone-call` is not premium model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setModel

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

`google-provided-model/phone-call` is not premium model.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |