Using the Text-to-Speech API with C#

Text-to-Speech API can be used to convert text
into natural-sounding audio. Let’s see how to use
Text-to-Speech with C-sharp. First, make sure the API
is enabled in your project, and a service account
exists to make API calls. Both are explained in the
call lab in the video notes. In Cloud Shell, let’s create a
simple .NET console lab and add Text-to-Speech API Nugget
package to the project. Open the Online Code Editor
and navigate to program.cs. We will convert a piece
of text to speech. Reference to Text-to-Speech
API Perry library. Create a Text-to-Speech client. Specify the text
we want to convert. Specify voice
selection parameters. And use MP3 as the audio format. Finally, code synthesized
speech on the input. And save the result
to an MP3 file. Let’s run the app. There you go. You just create a speech from
text using Text-to-Speech API. You can download and listen
the MP3 file if you like.

Leave a Reply

Your email address will not be published. Required fields are marked *