How To Use VWS With Text To Speech Date:04/01/2006
Revised:04/09/2006
ORIGINAL By:        Dan Turner (WA4BRO) RoswellWeather.Net   
DOC LINK Status: Implemented       Click Here To Download PDF Version

 

Goal:
You want to set up a radio style broadcast in voice on your web site or for local listening using output from VWS Tags to drive your Text To Speech engine. This is how I did it. There are other ways and programs and your mileage may vary! See http://www.roswellweather.net/#sunmoon for my current experimental implementation.

Step 1- Obtain a Text To Speech Program:

My 1st. step was to obtain http://nextup.com/purchase.html  Mega Package of Text To Speech programs. I was particularly drawn to their WeatherAloud and TextAloud programs. they are offered as Try Before You Buy and offer a discount to purchase 4 programs in their Mega Package. Price: 49.95. WeatherAloud looked promising for adding a local broadcast to my site. WeatherAloud allows hundreds of US and Global locations for Daily Forecast and Current Conditions and offers the ability to save to file in .wav or .mp3 format and different quality settings. The forecast generated in voice is the exact wording from the output forecasts from Hamweather. I am currently using WeatherAloud to generate the Atlanta Georgia Forecast here. This may change as I would like to get away from WeatherAloud and generate my own from an NWS point forecast. (Programmers and Script Writers - Please Contact me if you can help with a script to retrieve an http point forecast and strip it to text with some other params)

To generate my Local current conditions here. I was going to use TextAloud, but there was a problem. I searched high and low until I realized that TextAlound would not allow a command line invocation. After checking their F.A.Q. on their site (A little too late) I found that they do offer a command line interface but they want $250.00 for a license!  A $29.95 product and to use it from the command line 250 bucks! Well as they say here in the South ( I didn't fall off a chicken truck yesterday) Off to Google again. The next product I found and currently using is Alive's Text To Speech http://alivemedia.net/textspeech.htm $24.95 (More like it!) and it accepts command line calls and exits quite nicely after registering. Alives Text To Speech also allows your to save in several formats and .mp3 is one! We are on our way now!

Addendum: On 04/09/06 I have changed encoders to 2nd. Speech Center http://www.zero2000.com/  2nd. Speech Center has all the features of Alive's Text to speech and many additional options. It is Faster in processing the mp3 files and does it silently without popping up the program window. NOTE: Do not accept the default install directory during installation. Tell it to create and use a directory called iisc ie: c:\Program Files\iisc If you have already installed it to the default 2nd Speech Center Directory, quit the program and rename the directory to iisc  (You may have to adjust any short cuts to the proper directory. This process just makes it simpler and less mistakes in your batch files for paths.

Step 2 - Obtain A Quality Voice:

There are several companies that offer voice engines. I have tried the Cepstral Voices https://www.cepstral.com/ Emily is about their best but none seem to compare with The AT&T Natural Voices. In the AT&T voices I have found MIKE to be the best. Voices, including their engine run from between $25 to $35 per voice. They usually come in 8 Bit or 16 Bit versions. Be sure to buy at least the 16 Bit versions for use with VWS as they are of higher quality. I purchased all my voices from http://NextUp.Com and bought both the 8 and 16 bit versions. I also use CallSoft Pro http://www.mycallsoft.com/ a text to speech telephone answering system and it requires 8 bit voices for a modem as the modem rejects 16 bit voices. Note: Windows XP ships with a voice engine, You can use these to experiment with, however their quality stinks.

Step 3 - Now the fun begins:

Now install your voices, Alive's, Text To Speech and WeatherAloud if you decided to go that way for City Forecasts. Fire up the programs and take them for a spin. Notice in WeatherAloud under Options>Setting Voice and File Options You will find the menu to select your voice as the default and under the same tab on that window there is a FILE OPTIONS tab. After setting your default voice go to the File Options Tab and select Output file format as MP3, You can experiment with different levels of quality and compression ( I use 32KBS Mono) for the web as voice files get rather large quickly and there is not much need over the net for audio better than 32KBS.  Then set Your output file directory for the generated MP3. Next go to the Options>Auto Read Options. This menu is where you set your Cities that you have selected to output their forecast to the MP3 files. You can also select from here how often to generate and what specific parts of the forecast you want to generate. Ok now your are generating your files to the directory of your choosing. For me I decided to save them to my default windows drive in the root c:\  ( I know this is not really standard practice but for convenience of not having to set DOS paths in an autoexec,bat file and since the machine is dedicated to weather It was a quick way out with out writing much in my batch file later and I had another reason too.)  WeatherAloud will save your files by the city name. ie: AtlantaCity1.mp3 for the forecast and AtlantaCity2.mp3 for the current conditions. For additional cities they will be named for their location. ( Note I am not using WeatherAloud to generate my local conditions, this is where Alive's Text To Speech comes in to play.

Step 4 - Setting Up VWS and Alive's Text To Speech:

The next step is to set up VWS and allow VWS to generate what you want Alive's Text To Speech to Say and generate to an MP3 File for YOUR station's own weather data. Create a Text file using Note Pad or my Favorite- EditPlus http://www.editplus.com/ For my example I called mine VOICE.TXT Please see the example that I am using on on my site here http://roswellweather.net/voice.txt Save this file to c:\vws\template (Or in the template directory of VWS should you installed it elsewhere) You will notice This looks pretty much like a stock VWS template using standard VWS HTML Tags. The double line appearance, and extra (periods) are used to adjust the speech pattern and pauses. (This can all be experimented with to make your final adjustments). Use what ever tags and data you wish, This is just what I threw together to get me going, You can have it say anything you wish and whatever data you require. Now go to VWS under INTERNET>HTMLSETTINGS Pick and empty slot and on the left side browse to your VWS DIRECTORY, Under TEMPLATE you will find VOICE.TXT  then select it. On the opposite side of the window browse to a location you want to save the VOICE.TXT file after VWS populates it. Be sure to check how often you want to update it and turn it on. ( Here I saved mine AGAIN to the Root Directory c:\  so I can use it in my batch file. ( I do recommend it unless you want to spend some time setting up your DOS environment.)

Step 5 - Making Your Local Conditions Broadcast MP3 File:

Bring Up Text To Speech in windows. After loading go to the OPTIONS menu. Make sure the "convert to same folder as source file" is ticked. Then select output as MP3 and adjust to MONO and 32KBS. You can then exit Text To Speech.

In windows explorer navigate to C:\Program Files\AliveMedia\Text to Speech\ directory. Inside of the Text To Speech Directory, Right click over and select copy the file called TextToSpeech (Note there are two files called TextToSpeech, one is just a 0 byte configuration file, the other is the application (The application has an Icon that looks like a speaker sitting on a book and this is the one we want to copy) OK, after selecting copy, navigate back to your c:\ drive and paste the file in c:\

Ok you are getting close. Next using your text editor create a file ( You can call it anything, I called mine t2s.bat ) In this file place the following TWO lines:

echo off
texttospeech voice.txt /mp3

Then save the file as t2s.bat  ( Be sure to use the file extension of .bat or the file will not execute!)  This just calls TextToSpeech , reads in voice.txt and generates the MP3 file in the same directory

Addendum: 04/09/2006 If using 2nd. Speech center use the following commands instead of above.

echo off
cd \Program Files\iisc
ttscmd /ttm c:\voice.txt c:\voice.mp3 -e 20 -b 32
cd c:\

Then save the file as t2s.bat  ( Be sure to use the file extension of .bat or the file will not execute!)  This just calls 2nd. Speech Center , reads in voice.txt and generates the MP3 file in the same directory Please note in 2nd. Speech Center it gives you the option of which voice you want to use. In the above line the -e 20 is the voice selection I use. YOURS WILL VARY To list all the voices installed and their corresponding  number to use in the command Use the following command  c: \Program Files\iisc\ttscmd /e  Then select the voice's number to put after the -e on the above command line in your batch file.        

 

Step 6 - Automating And Making It All Happen:

You can now test to see if everything works before fully automating the task.  Open a windows command window. START>RUN Type command and enter. Then move to your root directory cd c:\   Now if you have everything running you should be able to type t2s at the prompt and it will invoke TextToSpeech in a window, read the voices.txt file that VWS created and write it out to a file called c:\voice.mp3  If it worked Great!, If not go back and check all the above steps.

The next thing to do is make all this happen without you being there. Now navigate to START>PROGRAMS>ACCESSORIES>SYSTEM TOOLS>SCHEDULED TASKS  This will bring up the windows task scheduler. Select add a task. This will start a wizard the wizard will ask you what to run and give you a list. Select BROWSE and browse to c:\t2s.bat  and select it. It will ten ask you how often you want to run it. Select DAILY then next. On the next screen click off EVERYDAY and accept the rest of the defaults and click next. On the next screen it should show the default MACHINE NAME/Administrator name (Make sure you are logged in with admin rights to XP) You will then need to enter and confirm the admn password then click next. On the next screen BE SURE TO CLICK OPEN ADVANCED SETTINGS TAB WHEN FINISHED then click finish.  A new window will appear, Click on the SCHEDULE Tab, Then Click on Advanced. Another new window will appear that says advanced schedule options. Here we want to click the box that says REPEAT task and then select the interval of minutes that you want to generate the mp3 file. Then close out of the scheduler, you are done. Now you should be generating your MP3 forecast file as often as you have selected.

Step 7 - What Do We Do From Here:

Here is where things will vary depending on your own setup. I will go over mine and then will offer some suggestions.


1. Make sure you are generating your voice.txt file from VWS as often as you need. My environment is that I run two machines. A windows XP machine dedicated to Weather, VWS, ImageSalsa, MovieSalsa, and three weather cams and NOW text to speech. I operate RoswellWeather.Net on my own Linux server here at home and have the web directory set up as a Samba Share on my own lan. I no longer FTP anything to a server. I let VWS and the Salsa's write directly to a MAPPED drive letter which is actually my Linux Webserver. I update EVERYTHING file wise from VWS every 60 seconds. The Salsas write out every second. I update the voice.txt in the templates directory every 60 seconds, but currently are only encoding the broadcasts every 4 minutes in task scheduler. (Poor old P4 3.0Ghz processor stays near 100 percent)

2. Getting your voice.mp3 file to your website can be done a a few ways. For me I just use the batch file to copy it after it is generated. No biggie, but for remote servers you will have to use either a simple batch file to ftp it from a command line ( See the salsa forum for one of these in another post I made in ftp'ing a movie up from the command line.) Or better yet use VWS, just select INTERNET>FTP UPLOAD and browse for the voice.mp3 file and send it as often and to where you want using VWS.

3. I would suggest just adding a link to the MP3 file from your site, as I initially used the html embed tag to place a player icon on the page and this causes the files to load as the page loads and really slows things down on page loads.

4. There was a question about running this locally on warnings and yes it would be possible and I plan to actually implement this on the site soon. So that if a warning is issued it will auto play on the page load. I think that it is possible to auto initiate it to play locally instead of the warning beep, just by selecting a program to run when the warning is received. You could start a batch file to encode the warning text from VWS, write the MP3 and play it all from the same calls I would think.

Closing Remarks :

I hope I have not missed anything here. It was a few late nights getting this all going and playing with the voice quality, speeds etc. I think I pretty well covered it, if not I will make revisions as needed. Once you get things going on your own system, you can play with things like voice speed, pitch, file sizes etc. in the programs. I have only offered what I have running currently in my experimental setup. As I said, Your mileage may vary.

I think VWS and VOICE was built for each other. A big thanks to Ed goes out from me for having the insight of the tagging system and ability to have an all in one expandable piece of software. I have only had this running for a few days and the e-mail from my users have been crazy!  The biggest comment was why can't the NWS have voice conditions available on all their local office pages!  I am sure it will be forthcoming.

As stated earlier, I really would love to get away from WeatherAloud and generate my own forecasts from the NWS pointcast webpage. I have not looked very much at programs to grab and strip the html tags very much. I have tried a few, but none that I can automate. WGET even fails at grabbing the page. If worse comes to worse, If we have an PHP guys in the group, I would like some hints at writing out the forecast from Hamweather in plain text. to a file that I can automate.
 

Addendum : 04/09/2006  I have since solved the Point Cast Retrieval Issue and with 2nd. Speech Center, No longer need to use any of the NextUp.Com products. You will however need access to a Linux box for WGET as the Windows compile will fail on getting the Point Forecasts. For Example here is the WGET command I use to get the Atlanta Point Forecast:
/usr/bin/wget -O Atlanta-Georgia.html 'http://www.srh.noaa.gov/ifps/MapClick.php?FcstType=text&textField1=33.76290&textField2=-84.42260&site=ffc&Radius=0&CiTemplate=0&TextType=1'

To make WGET handle the strange URL you have to enclose the URL in single quotes or it will fail.

The above line will now save the Atlanta Point Forecast to a file named Atlanta-Georgia.html , I then process this file using a fantastic Detagger Program called appropriately DETAGGER http://www.jafsoft.com/detagger/  To a text file and feed it to 2nd. Speech Center to generate the Point Forecast Voice broadcast. The point forecasts are updated every hour by NWS, thus I have WGET grab the page from a cron script 5 Minutes past the hour and also fire off my batch file to detag the html to text and feed it to 2nd. Speech Center.  I was using Windows Scheduler to process all the windows batch scripts, but I hated to see the DOS command window pop up during my other runs every 3 minutes. I have now since found yet another great Utility to replace the Windows Scheduler  It is called SYSTEM SCHEDULER and is available in a Free and Pro Version from http://www.splinterware.com/products/wincron.htm  I highly recommend this product as it will allow you to run ALL scheduler jobs in a HIDDEN mode. No more pop up DOS command window and it is simple to use. The only difference between the free and PRO version is that the PRO version can run as a windows service and carry on scheduled events even while logged off the system. AFIC this is a MUST download for anyone running scheduled events!

If you are running a Windows Box  for VWS and a Local Linux server to serve your site. You are really set at this point for total automation of voice generation! For those that have this setup and want to see more of my batch events, etc. Please send me an e-mail.

CALL FOR TESTERS : 04/09/2006 I have automated a way to get your local conditions to voice for inclusion on my site and hopefully soon on a commercially hosted site so that you may link to it.. The process is VERY simple to set up with a VWS machine and takes about 10 minutes to complete. I will supply you with the needed files and login. Please send mail to me at Admin (AT) RoswellWeather.Net if you are interested in helping me test this.
 

Enjoy!

Dan

 

USA Weather Finder

web page hit counter