Text to Speech

Building a php script for festival E-mail

Building a PHP script for Festival

To build a PHP front-end for text-to-speech processing, we'll create a HTML form that contains a textarea for what you want converted to speech, a text input field for the volume scale, and a checkbox whether to convert the WAV output to a MP3 file. I added a lot of comments for you to see what each part of the code does so I won't explain it here in great detail. All you need to know is that you type some text in the textarea, adjust the volume if you want and select whether output is MP3 or WAV. Once you click the Text-To-Speech button, the form performs a postback and the form data is captured and processed. The textarea data is written to a temp file for text2wave to convert and text2wave is executed using the PHP exec function. If the MP3 option is selected, a second exec is used to convert the WAV to MP3 using LAME. When the page reloads there is a link to the audio file next to the submit button. You can click on it to listen or right-click, 'Save Target As' to download it.

Click here for script

Comments (0)Add Comment

Write comment
smaller | bigger

security code
Write the displayed characters


busy
 
Next >