File Exchange

image thumbnail


version 1.0 (2.05 KB) by

text-to-speech, speech synthesis, tts, let Matlab speak

15 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

TTS text to speech.
TTS (TXT) synthesizes speech from string TXT, and speaks it. The audio format is mono, 16 bit, 16k Hz by default.

WAV = TTS(TXT) does not vocalize but output to the variable WAV.

TTS(TXT,VOICE) uses the specific voice. Use TTS('','List') to see a list of availble voices. Default is the first voice.

TTS(...,PACE) set the pace of speech to PACE. PACE ranges from -10 (slowest) to 10 (fastest). Default 0.

TTS(...,FS) set the sampling rate of the speech to FS kHz. FS must be one of the following: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000. Default 16.

This function requires the Mirosoft Win32 Speech API (SAPI).

% Speak the text;
tts('I can speak.');
% List availble voices;
tts('I can speak.','List');
% Do not speak out, store the speech in a variable;
w = tts('I can speak.',[],-4,44100);

Comments and Ratings (22)

Very cool indeed

Dogba Djaze

Very nice job. Thank you very much.

amala david

how to convert tamil text to eng?

David Lo


Excellent.thank you very much

prince garg

good program very clear output
but i got a question ?
how do i store this mp3 file

Pratik Oak

how to add voice option

Ho to add new language to list ??? I need to get polish languages.


lee (view profile)

Excellent, thank you, works perfectly. Here is the code I used to create a nice compressed .ogg audio file:

% List availble voices;
tts('I can speak.','List');
% Use one of the voices from the list
w = tts('1, 2, 3, 4, 5','Microsoft Zira Desktop - English (United States)',0,44100);
% Save the data as a compressed .ogg audio file

@ Friends / Mr. SAI PRATHAP REDDY KATHI..Can you please tell me "How you are taking input from the text file "??
pl help

Thank you very much. I take a variable to read text from .txt and i give this variable tts function it working. thank you

Mihir Phatak



Cedric (view profile)

How do I get more speech profiles? I only have microsoft anna...

Pardeep Singh

awesome work sir. excellent..thanks sir


milan (view profile)

hi, can you explain me how exactly text is converted to speech
because i have taken this as my project but i m not getting function tts that how it converts text to speech signal


Surya (view profile)

zee nisa

i want to send text file as an input and speech as out put in matlab...
plz help me out


Sidra (view profile)

goood work

vikas patel

nice work its really helpful to me...

gghh www


nikhil ekka

MATLAB Release
MATLAB 7.4 (R2007a)

MATLAB Online Live Editor Challenge

Win cash prizes and have your live script featured on our website

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video