/// <summary>Snippet for ListVoicesAsync</summary>
        public async Task ListVoicesAsync()
        {
            // Snippet: ListVoicesAsync(string, CallSettings)
            // Additional: ListVoicesAsync(string, CancellationToken)
            // Create client
            TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();

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

            // End snippet
        }
        /// <summary>Snippet for ListVoicesAsync</summary>
        public async Task ListVoicesAsync_RequestObject()
        {
            // Snippet: ListVoicesAsync(ListVoicesRequest,CallSettings)
            // Additional: ListVoicesAsync(ListVoicesRequest,CancellationToken)
            // Create client
            TextToSpeechClient textToSpeechClient = await TextToSpeechClient.CreateAsync();

            // Initialize request argument(s)
            ListVoicesRequest request = new ListVoicesRequest();
            // Make the request
            ListVoicesResponse response = await textToSpeechClient.ListVoicesAsync(request);

            // End snippet
        }
        /// <summary>Snippet for SynthesizeSpeechAsync</summary>
        public async Task SynthesizeSpeechAsync()
        {
            // Snippet: SynthesizeSpeechAsync(SynthesisInput, VoiceSelectionParams, AudioConfig, CallSettings)
            // Additional: SynthesizeSpeechAsync(SynthesisInput, VoiceSelectionParams, AudioConfig, CancellationToken)
            // 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);

            // End snippet
        }
Пример #4
0
        /// <summary>Snippet for SynthesizeSpeechAsync</summary>
        public async Task SynthesizeSpeechRequestObjectAsync()
        {
            // Snippet: SynthesizeSpeechAsync(SynthesizeSpeechRequest, CallSettings)
            // Additional: SynthesizeSpeechAsync(SynthesizeSpeechRequest, CancellationToken)
            // 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,
                },
            };
            // Make the request
            SynthesizeSpeechResponse response = await textToSpeechClient.SynthesizeSpeechAsync(request);

            // End snippet
        }