File Exchange

image thumbnail


version (2.05 KB) by Siyi Deng
text-to-speech, speech synthesis, tts, let Matlab speak


Updated 26 Dec 2007

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 (30)

Matt J

when using this function to read a long text is there a way to interrupt it so that it doesn't continue reading all the remaining text?

Gautam Kumar



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.


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



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

awesome work sir. excellent..thanks sir


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


zee nisa

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


goood work

vikas patel

nice work its really helpful to me...

gghh www


nikhil ekka

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux