AI Learning Record – Azure Text-to-Speech (TTS) Service

A while ago, I searched for a long time to find a free Chinese-to-speech language model with no results. I had to learn how to use Microsoft’s text-to-speech service instead.

The Azure TTS service is highly regarded for its good performance, offering a wide range of languages and voices. Many YouTube voiceovers are created using it, and it provides a free quota of 5 million characters per month to use. Since there should be many tutorials online about registration, I will just provide my code here as a quick start.

Assuming the service has been applied for and a speech service has been set up, to enter the page that converts text to speech: search for “Azure TTS” on Google -> log in from the upper right corner -> select resources -> your speech service -> go to speech studio -> scroll down to find Text-to-Speech.

As shown in the picture, you can select different voices and listen to them, try them out, and use the code. The code part will automatically insert the name of the role and the style into the trial according to the voice you are trying. But I haven’t tried it yet, so I still don’t know how to insert the style into the program.

My Sample Code

To use Azure services, you need to install its SDK.

My sample code to run TTS.

L3~4: Input your key and region. The example from Azure will have it pre-filled for you. If you forget, you can refer directly to it.

L7: Specify the output format as mp3. If not specified, it will be read out directly.

L8: The text you want to do TTS

L15~16: save the result to MP3

 

Conclusion

Microsoft’s speech effect is indeed very good, even I am considering joining the ranks of YouTube content farms. It turns out that all the videos I watch every day are like this!

Leave a Reply(Name請以user_開頭,否則會被判定會垃圾息)

請輸入答案 66 + = 75