Advertisment

Get from Web. Stream on Intranet

author-image
PCQ Bureau
New Update

The first few things you do when you come into office are switch on your PC or laptop, hook into your corporate network, open your mail client and hit Receive. While the mail downloads, you connect your instant messenger and put your Palm in its cradle to hot sync it. Then you probably run your appointment scheduler application and look through the meetings scheduled for the day. Imagine if during this process, you could have the latest news, technological breakthroughs, stock quotes and the weather for the day, read out to you aloud? Not only this, but also the required information updated in audio at frequent intervals throughout the day. Interests you? Read on.

Advertisment

Audio is registered more by your senses than just text on a computer screen. We thought of this concept with the same motive

in mind. What if information comes to the user as a background task and in a different medium than text? Here is the

methodology–aggregate content from the Web, convert it to audio and stream it on the intranet.

A cursory glance at the kind of software available on the Internet showed that there are indeed many programs that could do some part or the other of the idea we had. In fact, some of the software could also do a combination of the first two steps–aggregate from Web and convert to audio–(though restricted in customizability). So we got the software to interface (communicate) with each other. Though the process may appear crude, the purpose is to demonstrate that it is possible to aggregate, convert and stream content using free tools. 

Get the data



One way to get news from websites is to manually append the latest news headlines to the text file, each day. The second way–our way–is to write some code to download the latest news from news websites. News is hosted in XML format in a file with RDF extension on many popular news sites. These are used by news-ticker applications to connect to them and display the news headlines and other related content as a continuously running ticker. On this month’s CD, we have given a small Java program called NewsParser in the directory /cdrom/Dev Lab/Source/. This connects to the news sites and retrieves the RDF file. Let us set up this program to run and do our job. 

Advertisment

Copy the files NewsParser.java and sites.txt from the directory of this month’s CD to a directory, say java on your hard disk. NewsParser.java file contains the code for the program and sites.txt file contains URLs to RDF files. You can append more URLs in addition to the existing ones. But note that you must append each URL on a separate line. 

To use (compile and execute) the NewsParser program you must install JDK (Java Development Kit) and Java XML pack. First, Install JDK (found in the Dev Labs > SDK/IDE section on this month’s CD). By default JDK will be installed in a directory named j2sdk1.4.0. For Java XML Pack, extract the zipped archive named java_xml_pack-winter01_01-dev.zip of the Java XML pack found in the same CD-ROM, onto your hard disk (say C:\). Now copy the file named xerces.jar (found in the subdirectory jaxp-1.2-ea1 of the extracted archive) to j2sdk1.4.0/lib directory. Change to the directory C:\java, where you copied NewsParser.java and sites.txt earlier and issue the command

C:\j2sdk1.4.0\bin\javac -classpath c:\j2sdk1.4.0\lib\xerces.jar;. NewsParser.java

Advertisment

To execute the NewsParser, use the command

C:\java\java NewsParser > news.txt 

(this would send the output of the parser to a text file called news.txt)You may ask, why the need of our own parser when there are lots of news ticker applications already available that do the job? This was to keep matters simple. We made our parser just a simple piece of code to perform only the intended task. This makes it light and also customizable. We can always add content sources to it at will. 

Advertisment

Here comes sound



This news/data that has been parsed into readable text content, now needs to be converted to audio. Any standard

text-to-speech software does this. It reads from text files or from within applications using the Windows Clipboard and gives

the output either as WAV/MP3 audio files or just as a sound output from your sound card. 

We used software called Talking Clipboard for our purpose. This uses Microsoft Agent technology and works on any Win 2000/XP machine with the speech components installed on it. The application sits in your system tray with the Merlin character and monitors the clipboard for text. The moment it finds some data there, it reads it out. To interface it with our news parser, we piped the output of the parser to the clipboard. This was made possible by a small command line utility called cb. Just extract the executable into your Windows System directory. The command for the same is | cb. So, instead of sending the output of our parser to a text file, we send it to the clipboard as follows.

C:\java NewsParser | cb

Advertisment

The Talking Clipboard application is started before running the parser. On giving the above command at the prompt, the application is invoked and starts 2

reading the text on the clipboard. Merlin and a balloon showing the contents read, indicate this.

Time to stream



Now you have the audio being read out of your sound card. For streaming this audio, we used Microsoft’s NetShow Encoder (you may use Windows Media Encoder too, or any other live streaming application for that matter). NetShow Encoder gives you the option of capturing audio from your sound card’s line-in or mic-in socket. This is used for broadcasting media content from a live source.

But before you can stream the audio content, you need to channel the output of the sound card to its input. This is a loopback method. For the purpose, you can use a software loopback, which essentially creates a virtual audio cable between the sound card’s output and input. The transfer is digital and hence there is no quality loss. We used software called VAC (Virtual Audio Cable) for this. You can also use an application like Total Recorder. VAC installs as a driver on your PC and does away with a physical interconnection of the concerned In/Out pairs. Make sure that VAC is running before you start up your streaming server. 

Advertisment

Configure NetShow Encoder to capture from Live Source and select the format of encoding and the bandwidth you want to use. The encoder also allows you to store the audio content locally as an ASF file for archival purposes. This file can be hyper-linked to a Web page too.

Checklist



So, finally you have the following software 

  • cb for pipe to Windows Clipboard
  • Talking Clipboard (or any other clipboard reader) for text-to-speech
  • VAC (or Total Recorder) for software loopback on your sound card
  • NetShow Encoder (or any other streaming server software)
Advertisment

The clients connect to the server URL using Windows Media Player. Just run the news parser from a prompt and there you are! For regular updated audio, you can place the parser in a batch file and schedule it to run at specific intervals using the Windows Task Scheduler.

The application of this system is not limited to just getting news from websites. You can use it to broadcast any text as audio. An administrator can select an important piece of information from anywhere (web page or file) and just hit Crtl+C to transmit it as audio on the intranet. With slight ingenuity, it can also serve as a public address system for office-wide announcements, meetings and even entertainment like a regular cricket commentary broadcast! 

Ashish Sharma and  Shekhar Govindarajan 

Software: Been there. Done that

Apple made the computer talk even while others were still working on the idea. Speech synthesis is not at all new to Mac users. Their machines diligently announce error messages, read Web pages or text documents. Apple’s speech synthesis technology is called PlainTalk and converts text to spoken words. 

A Mac reads out two kinds of text–one is from applications and the other is a system message. Within applications, you can have SimpleText files read out aloud, Web pages made speakable, etc. With SimpleText, just select a particular section of the text and go to the Sound menu to have it read out to you. The shortcut is Apple key+J. You can also change the reading voice from the Sound menu. There are 25 different voices in Mac OS 9.1 and they range from regular male and female voices to interesting ones like Deranged, Hysterical or Whisper.

Alert messages like Not able to load a Web page, Confirm delete, etc are read out to the user after a wait interval. This catches your attention when you are busy on something else and the Mac knows that you have not paid attention to it. These are called Talking Alerts and the settings can be controlled from the Speech Control Panel in the Dock bar. In the Speech Control Panel, you can set the default voice and the way an alert should be read. For example, you can choose a default read of the alert message in the box, or can add a preset phrase to it, say Oh My! or It’s not my fault!. The preset phrases are an exciting way of announcing and you may even randomize them to be pre-said before the actual alert message. The voice playback rate is also adjusted from this control panel.

Advertisment