File Exchange

image thumbnail

Text to Speech Mandarin Demo (Can mix Chinese with English)

version 1.0.0 (674 KB) by Pink_panther
This uses Microsoft .NET speech synthesis, with Mandarin Female voice Hanhan. Can use this in your MATLAB programming environment directly.

1 Download

Updated 22 Jan 2021

View License

If you want to use text to Mandarin, at least you need to have Chinese character installed on Windows. If you can type Chinese character in Notepad, you should be able to get this.
The MATLAB has command to call Microsoft NET, you can type "help System.Speech" to get more details, you should not need any toolbox to do this.

In case you could not get it running, please view the included MP4 video, see how it works, and leave a feedback, so we can help to update code.

Cite As

Pink_panther (2021). Text to Speech Mandarin Demo (Can mix Chinese with English) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Chang hsiung


@Hsiung, you can also try this, change "Hanhan" to "Huihui", I just tried installing additional language simplified CN, I gained Huihui Voice.
So basically if you installed Traditional, you get Hanhan, and with Simplified, you get Huihui. Thanks


Dear Hsiung, I assume you can hear default male English voice. Please run the following code,
(I only have traditional language installed on my Windows 10)
% Check what voices installed on your PC
obj = System.Speech.Synthesis.SpeechSynthesizer;
% You should have David, it is default Male English voice
Speak(obj,'This is a Test')
voices = obj.GetInstalledVoices;
for i = 1 : voices.Count
voice = Item(voices,i-1);
this is what I got in return:
>> matlab_check_installed_voices
Microsoft David Desktop

Microsoft Zira Desktop

Microsoft Hanhan Desktop

Chang hsiung

when I tried to run this --> obj.SelectVoice('Microsoft Hanhan Desktop') %Hanhan 講中文
I got the following error ??
obj.SelectVoice('Microsoft Hanhan Desktop') %Hanhan 講中文
Message: Cannot set voice. No matching voice is installed or the voice was disabled.
Source: System.Speech


Please download the zipfile, which includes a short demo video, in case your PC can not type Chinese, you can still hear what the Mandarin Female voice sounds like.

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!