A talking spaceship

I got a wiki setup that seems to work reasonably well. It can be found here at Spaceroom Wiki. My main goal with it is to have a shared space for putting various design notes and ideas.

I’m sorry Dave, I can’t do that.

After the introduction of HAL, who wouldn’t want a talking spacecraft? Now it is possible by taking advantage of the the Microsoft Speech API which allows developers to write code that will both convert text to speech, as well as recognize speech, and even execute commands as a result. The API is implemented as a COM interface so most languages should be able to access it. In Delphi it is as simple as importing the Type Library and installing the components on the toolbar.

The code from there is print simple:

Drop an SPVoice component on a form and include a line like this:

SPVoice.Speak('This is a test',SVFSDefault);

This tells the speech system to say the text in synchronous mode. It is also possible to tell it to play asynchronously as well as include specific voice directives through different setting parameters. It is a bit more work to enumerate the available voices and select them but not much.

This will be handy for a number of things. It will allow for programmatic voicing such as from a Flight Control center or as a automated system message or warning. It could also be useful as a universal translator for alien contact.

I think the next step is to create a more Delphi style wrapper object that will make it even simpler to use, (like preloading the available voices and making the choice a simple object property).

Tags: