4 - Providing input
Submitted by Webbot on October 30, 2008 - 5:46pm.
The previous section has talked about the different modes and their associated hardware setup. But how do you make the thing make a noise!!
Assuming that you have created the synthesizer as a seperate board then:-
- Once the software is started up it goes into a main loop that accepts characters from the UART
- You can therefore attach it to either another micro controller board or, via a MAX232 chip, to the serial port of your pc
- Any characters you type are echoed back. Once you press Enter the sentence is spoken. Any error messages are also sent back to hyperterminal. Why would I get errors? The software works 'a line at a time' - so the line of text may be too long for it to cope. Alternatively it may contain characters that is doesn't recognise (like a backspace or a euro currency symbol).
- If the first character on a line is a '*' symbol then it assumes that the rest of the line is made of 'phonemes' rather than English text. See the section about the valid phonemes.
- If the first character on a line is a "!" symbol and is followed by a single character between A and Z then the input is treated as a command to change the default voice pitch. ie "!A" will change to the highest pitch voice and "!Z" will change to the lowest. These settings are remembered until the next reboot. The default value is "!G"
If you have linked the code into your own code then there is no main loop.Instead you can call the following methods:-
- say("An English phrase");
- speak("Some phonemes");
- setPitch(val); where val is 0 to 25, to change the default voice pitch
Note that, by default, the UART is programmed to use 19200 baud, 8 data, no parity, and 1 stop bit. The baud rate can be changed in 'core.c' in the method called 'init'.