# Google Cloud Text-to-Speech v1beta1 API - Class TextToSpeechClient (2.0.0-beta18)

2.0.0-beta18 (latest) 2.0.0-beta17 1.0.0-beta04

    public abstract class TextToSpeechClient

Reference documentation and code samples for the Google Cloud Text-to-Speech v1beta1 API class TextToSpeechClient.

TextToSpeech client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> TextToSpeechClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[TextToSpeechClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClientImpl)

## Namespace

[Google.Cloud.TextToSpeech.V1Beta1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1)

## Assembly

Google.Cloud.TextToSpeech.V1Beta1.dll

## Remarks

Service that implements Google Cloud Text-to-Speech API.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the TextToSpeech service, which is a host of "texttospeech.googleapis.com" and a
port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default TextToSpeech scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default TextToSpeech scopes are:

- <https://www.googleapis.com/auth/cloud-platform>

### GrpcClient

    public virtual TextToSpeech.TextToSpeechClient GrpcClient { get; }

The underlying gRPC TextToSpeech client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeech.TextToSpeechClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### Create()

    public static TextToSpeechClient Create()

Synchronously creates a [TextToSpeechClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [TextToSpeechClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient` | The created [TextToSpeechClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient). |

### CreateAsync(CancellationToken)

    public static Task<TextToSpeechClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [TextToSpeechClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [TextToSpeechClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient` | The task representing the created [TextToSpeechClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient). |

### ListVoices(ListVoicesRequest, CallSettings)

    public virtual ListVoicesResponse ListVoices(ListVoicesRequest request, CallSettings callSettings = null)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | The RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create();
    // Initialize request argument(s)
    ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "", };
    // Make the request
    ListVoicesResponse response = textToSpeechClient.ListVoices(request);

### ListVoices(string, CallSettings)

    public virtual ListVoicesResponse ListVoices(string languageCode, CallSettings callSettings = null)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `languageCode` | `https://learn.microsoft.com/dotnet/api/system.string` Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | The RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create();
    // Initialize request argument(s)
    string languageCode = "";
    // Make the request
    ListVoicesResponse response = textToSpeechClient.ListVoices(languageCode);

### ListVoicesAsync(ListVoicesRequest, CallSettings)

    public virtual Task<ListVoicesResponse> ListVoicesAsync(ListVoicesRequest request, CallSettings callSettings = null)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "", };
    // Make the request
    ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(request);

### ListVoicesAsync(ListVoicesRequest, CancellationToken)

    public virtual Task<ListVoicesResponse> ListVoicesAsync(ListVoicesRequest request, CancellationToken cancellationToken)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "", };
    // Make the request
    ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(request);

### ListVoicesAsync(string, CallSettings)

    public virtual Task<ListVoicesResponse> ListVoicesAsync(string languageCode, CallSettings callSettings = null)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `languageCode` | `https://learn.microsoft.com/dotnet/api/system.string` Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    string languageCode = "";
    // Make the request
    ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(languageCode);

### ListVoicesAsync(string, CancellationToken)

    public virtual Task<ListVoicesResponse> ListVoicesAsync(string languageCode, CancellationToken cancellationToken)

Returns a list of Voice supported for synthesis.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `languageCode` | `https://learn.microsoft.com/dotnet/api/system.string` Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.ListVoicesResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    string languageCode = "";
    // Make the request
    ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(languageCode);

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient#Google_Cloud_TextToSpeech_V1Beta1_TextToSpeechClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient#Google_Cloud_TextToSpeech_V1Beta1_TextToSpeechClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient#Google_Cloud_TextToSpeech_V1Beta1_TextToSpeechClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient#Google_Cloud_TextToSpeech_V1Beta1_TextToSpeechClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### StreamingSynthesize(CallSettings, BidirectionalStreamingSettings)

    public virtual TextToSpeechClient.StreamingSynthesizeStream StreamingSynthesize(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Performs bidirectional streaming speech synthesis: receives audio while
sending text.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |
| `streamingSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings.html` If not null, applies streaming overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.TextToSpeechClient.StreamingSynthesizeStream` | The client-server stream. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create();
    // Initialize streaming call, retrieving the stream object
    using TextToSpeechClient.StreamingSynthesizeStream response = textToSpeechClient.StreamingSynthesize();

    // Sending requests and retrieving responses can be arbitrarily interleaved
    // Exact sequence will depend on client/server behavior

    // Create task to do something with responses from server
    Task responseHandlerTask = Task.Run(async () =>
    {
        // Note that C# 8 code can use await foreach
        AsyncResponseStream<StreamingSynthesizeResponse> responseStream = response.GetResponseStream();
        while (await responseStream.MoveNextAsync())
        {
            StreamingSynthesizeResponse responseItem = responseStream.Current;
            // Do something with streamed response
        }
        // The response stream has completed
    });

    // Send requests to the server
    bool done = false;
    while (!done)
    {
        // Initialize a request
        StreamingSynthesizeRequest request = new StreamingSynthesizeRequest
        {
            StreamingConfig = new StreamingSynthesizeConfig(),
        };
        // Stream a request to the server
        await response.WriteAsync(request);
        // Set "done" to true when sending requests is complete
    }

    // Complete writing requests to the stream
    await response.WriteCompleteAsync();
    // Await the response handler
    // This will complete once all server responses have been processed
    await responseHandlerTask;

### SynthesizeSpeech(SynthesisInput, VoiceSelectionParams, AudioConfig, CallSettings)

    public virtual SynthesizeSpeechResponse SynthesizeSpeech(SynthesisInput input, VoiceSelectionParams voice, AudioConfig audioConfig, CallSettings callSettings = null)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `input` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesisInput` Required. The Synthesizer requires either plain text or SSML as input. |
| `voice` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.VoiceSelectionParams` Required. The desired voice of the synthesized audio. |
| `audioConfig` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.AudioConfig` Required. The configuration of the synthesized audio. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | The RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create();
    // Initialize request argument(s)
    SynthesisInput input = new SynthesisInput();
    VoiceSelectionParams voice = new VoiceSelectionParams();
    AudioConfig audioConfig = new AudioConfig();
    // Make the request
    SynthesizeSpeechResponse response = textToSpeechClient.SynthesizeSpeech(input, voice, audioConfig);

### SynthesizeSpeech(SynthesizeSpeechRequest, CallSettings)

    public virtual SynthesizeSpeechResponse SynthesizeSpeech(SynthesizeSpeechRequest request, CallSettings callSettings = null)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | The RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = TextToSpeechClient.Create();
    // Initialize request argument(s)
    SynthesizeSpeechRequest request = new SynthesizeSpeechRequest
    {
        Input = new SynthesisInput(),
        Voice = new VoiceSelectionParams(),
        AudioConfig = new AudioConfig(),
        EnableTimePointing =
        {
            SynthesizeSpeechRequest.Types.TimepointType.Unspecified,
        },
        AdvancedVoiceOptions = new AdvancedVoiceOptions(),
    };
    // Make the request
    SynthesizeSpeechResponse response = textToSpeechClient.SynthesizeSpeech(request);

### SynthesizeSpeechAsync(SynthesisInput, VoiceSelectionParams, AudioConfig, CallSettings)

    public virtual Task<SynthesizeSpeechResponse> SynthesizeSpeechAsync(SynthesisInput input, VoiceSelectionParams voice, AudioConfig audioConfig, CallSettings callSettings = null)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `input` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesisInput` Required. The Synthesizer requires either plain text or SSML as input. |
| `voice` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.VoiceSelectionParams` Required. The desired voice of the synthesized audio. |
| `audioConfig` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.AudioConfig` Required. The configuration of the synthesized audio. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    SynthesisInput input = new SynthesisInput();
    VoiceSelectionParams voice = new VoiceSelectionParams();
    AudioConfig audioConfig = new AudioConfig();
    // Make the request
    SynthesizeSpeechResponse response = await textToSpeechClient.SynthesizeSpeechAsync(input, voice, audioConfig);

### SynthesizeSpeechAsync(SynthesisInput, VoiceSelectionParams, AudioConfig, CancellationToken)

    public virtual Task<SynthesizeSpeechResponse> SynthesizeSpeechAsync(SynthesisInput input, VoiceSelectionParams voice, AudioConfig audioConfig, CancellationToken cancellationToken)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `input` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesisInput` Required. The Synthesizer requires either plain text or SSML as input. |
| `voice` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.VoiceSelectionParams` Required. The desired voice of the synthesized audio. |
| `audioConfig` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.AudioConfig` Required. The configuration of the synthesized audio. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    SynthesisInput input = new SynthesisInput();
    VoiceSelectionParams voice = new VoiceSelectionParams();
    AudioConfig audioConfig = new AudioConfig();
    // Make the request
    SynthesizeSpeechResponse response = await textToSpeechClient.SynthesizeSpeechAsync(input, voice, audioConfig);

### SynthesizeSpeechAsync(SynthesizeSpeechRequest, CallSettings)

    public virtual Task<SynthesizeSpeechResponse> SynthesizeSpeechAsync(SynthesizeSpeechRequest request, CallSettings callSettings = null)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    SynthesizeSpeechRequest request = new SynthesizeSpeechRequest
    {
        Input = new SynthesisInput(),
        Voice = new VoiceSelectionParams(),
        AudioConfig = new AudioConfig(),
        EnableTimePointing =
        {
            SynthesizeSpeechRequest.Types.TimepointType.Unspecified,
        },
        AdvancedVoiceOptions = new AdvancedVoiceOptions(),
    };
    // Make the request
    SynthesizeSpeechResponse response = await textToSpeechClient.SynthesizeSpeechAsync(request);

### SynthesizeSpeechAsync(SynthesizeSpeechRequest, CancellationToken)

    public virtual Task<SynthesizeSpeechResponse> SynthesizeSpeechAsync(SynthesizeSpeechRequest request, CancellationToken cancellationToken)

Synthesizes speech synchronously: receive results after all text input
has been processed.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.TextToSpeech.V1Beta1/latest/Google.Cloud.TextToSpeech.V1Beta1.SynthesizeSpeechResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();
    // Initialize request argument(s)
    SynthesizeSpeechRequest request = new SynthesizeSpeechRequest
    {
        Input = new SynthesisInput(),
        Voice = new VoiceSelectionParams(),
        AudioConfig = new AudioConfig(),
        EnableTimePointing =
        {
            SynthesizeSpeechRequest.Types.TimepointType.Unspecified,
        },
        AdvancedVoiceOptions = new AdvancedVoiceOptions(),
    };
    // Make the request
    SynthesizeSpeechResponse response = await textToSpeechClient.SynthesizeSpeechAsync(request);