An introduction to SALT
Filed under: Javascript, Languages, Programming, Technology, Web Programming
The speech engine that I was talking about in my last article about speech synthesis is an add-in for
To actually create speech enabled web pages, you need to use SALT.Speech Application Language Tags is now fairly standard and being supported by
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
<object id="saltobject" classid="clsid:33cbfc53-a7de-491a-90f3-0e782a7e347a"></object>
<?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 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 seperation 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 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
