5.0

5.0 | 2 ratings Rate this file 61 downloads (last 30 days) File Size: 83.89 KB File ID: #11297

text2speech

by Wolfgang Garn

 

04 Jun 2006 (Updated 06 Jun 2006)

Code covered by BSD License  

Converts text to speech.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

Any text is spoken.
 
Get started...
1. Make sure SAPI is installed on your computer
   a) get the Speech SDK 5.1 (86MB) for free from Microsoft:
http://www.microsoft.com/downloads/details.aspx?FamilyId=5E86EC97-40A7-453F-B0EE-6583171B4530&displaylang=en
   b) test your default computer voice
Start->Control Panel-> Sounds,Speech...->Speech->Text To Speech->Preview Voice
2. add the text2speech folder to your Matlab path
3. Test your new function: text2speech('This is a test.')

I would like to thank "Desmond Lang" for his Text-To-Speech tutorial
and my wife for letting me play with the computer ;).

You can find Desmond's tutorial at:
http://www.gamedev.net/reference/articles/article1904.asp

Example:
Casual chat.
text2speech({'Hello. How are you?','It is nice to speak to you.','regards SAPI.'})

Emphasising
text2speech('You can <EMPH> emphasis </EMPH> text.');

Silence
text2speech('There will be silence now <SILENCE MSEC=''500''/> and speech again.');

text2speech('You can <pitch middle=''-10''/> drop the pitch.');
text2speech('But you can make it <pitch middle=''+10''/> jump as well.');

Other related work:
Just before I put this text2speech into the file exchange, I noticed something
pretty similar, written by Fahad Al Mahmood called speak:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4769&objectType=file

 
This work is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
This work is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

MATLAB release MATLAB 7.0.4 (R14SP2)
Other requirements Microsoft SAPI (Speech SDK 5.1)
Zip File Content  
Published M Files initSpeech, Speak, text2speech, unloadSpeechLibrary
HTML Files text2speech/html/index.html
Other Files text2speech/wgText2Speech.lib,
text2speech/wgText2Speech.dll,
text2speech/unloadSpeechLibrary.m,
text2speech/text2speech.m,
text2speech/initSpeech.m,
text2speech/Speak.m,
text2speech/Speak.h,
text2speech/readme.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
17 Apr 2007 Nathan Miller

Works beautifully!

03 Nov 2007 bharath kumar

hi when i try to execute this code it says Undefined function or variable loadlibrary
can anyone plz help me

21 Jun 2009 marian nasry

thanks for this code very much , but i've one question : how can I control the speed of the speech;
please help me

24 Jul 2009 Wolfgang Garn

Speed tag: <rate absspeed="5">, relative speed <rate speed="2"> Values are between -10 and +10.
See XML TTS tutorial (http://msdn.microsoft.com/en-us/library/ms717077(VS.85).aspx ) for more information.

10 Sep 2009 M

I get stuck when loading the speech library.

This program calls MATLAB's loadlibrary function, which in turn calls the function loaddefinedlibrary. At that point, MATLAB hangs. I let it go for a few minutes and then have to force-quit MATLAB from the Task Manager. I don't get an error message, so I am not sure I have the same error as people who do get an error message about not having a module installed.

Any idea how to fix this issue? I guess it is more general than text2speech but am wondering if anyone ran across this error while using the program.

Please login to add a comment or rating.
Updates
24 Jul 2009

Matlab 2009 release (version 7.8+) usage of SpeechSynthesizer recommended.

Tag Activity for this File
Tag Applied By Date/Time
sound Wolfgang Garn 22 Oct 2008 08:27:50
text2speech Wolfgang Garn 22 Oct 2008 08:27:50
speak Wolfgang Garn 22 Oct 2008 08:27:50
sapi Wolfgang Garn 22 Oct 2008 08:27:51
text to speech Wolfgang Garn 22 Oct 2008 08:27:51
potw Cristina McIntire 07 Nov 2008 13:03:11
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com