An introduction to SALT

The speech engine that I was talking about in my last article about speech synthesis is an add-in for Internet Explorer. Follow these instructions to install it yourself (you can get Microsoft Speech Application Software Development Kit (SASDK) Version 1.1 now though).

To actually create speech enabled web pages, you need to use SALT. Speech Application Language Tags is now fairly standard and being supported by Microsoft means it is almost guaranteed to survive in some form. SALT is an XML markup so you would generally embed it straight into a HTML (or more usually an XHTML) page.

The first requirement is to add the SALT namespace to your XHTML document: <html xmlns:salt="http://www.saltforum.org/2002/SALT"> This probably isn’t a requirement but you should do it anyway. The next thing you need to do is to load the add-in and tell it what to handle. This is definitely vendor specific and only applies to the add-in for IE: <?import namespace="salt" implementation="#saltobject" /> All the code does is create an object and then tell it what namespace to look for SALT tags in (in this case the “salt” namespace). There is one potential sticking point. The standalone IE add-in is not the same as the one you get if you install the whole SDK so for debugging purposes so the classid will be different.

After that it’s just a matter of adding the SALT tags for handling the speech. In this article I’ll just deal with the simplest one, prompts. A prompt is just a piece of speech. Just write your speech inside a <salt:prompt> tag: <salt:prompt id="InstructionsPrompt"> Hello. Thank you for using this salt demo. </salt:prompt> The id can be anything you want as it is only used to uniquely identify the prompt.

We now have to get around the semantic separation of form and function: this simply defines a prompt and doesn’t actually do anything with it. To actually make it do something we have to use JavaScript. Prompt objects all have a Start() function accessible from JavaScript so to make it play, just call InstructionsPrompt.Start(). Although it’s not an ideal solution for testing purposes just attach it to the onload event of the body tag. You can see (and hear) the whole SALT demo.

A final note about voices. Windows XP comes with a good voice called Microsoft Mike, but this may not be the default. Some of the others sound really bad. To set Mike as the default: Start -> Control Panel -> Speech -> Text-to-speech Windows Vista will come with new voices (the ones made from sampled sounds I talked about before), one of which is called Anna.