' ========================================================================= ' ' File...... EasyEmic.BS2 ' Purpose... Simple Emic TTS demonstration ' Author.... Parallax, Inc. (Copyright (c) 2004, All Rights Reserved) ' E-mail.... support@parallax.com ' Started... ' Updated... 28 APR 2004 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' Simple Emic TTS speech demo. Be sure to set both Emic DIP switches to ' the OFF (down) position. ' -----[ I/O Definitions ]------------------------------------------------- Tx PIN 0 ' connects to Emic SIn Rx PIN 1 ' connects to Emic SOut Busy PIN 2 ' 1 = busy ' -----[ Constants ]------------------------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE Baud CON 396 ' 2400 baud, N81 #CASE BS2SX, BS2P Baud CON 1021 #ENDSELECT Yes CON 1 No CON 0 ' Emic Commands (Hex Mode) Say CON $00 ' say Engish text Volume CON $01 ' set volume, 0 - 7 Speed CON $02 ' set speed, 0 - 4 Pitch CON $03 ' set pitch, 0 - 6 AddAbbr CON $04 ' add abbreviation DelAbbr CON $05 ' delete abbreviation ListAbbr CON $06 ' list abbreviations Version CON $07 ' get version Reset CON $08 ' soft reset Audio CON $09 ' enable audio in PhT CON $10 ' start of phonetic text Help CON $FE ' display help EOM CON $AA ' end of message OK CON $55 ' "okay" for hex mode ' -----[ Program Code ]---------------------------------------------------- Main: DO GOSUB Check_Busy SEROUT Tx, Baud, [Say, "Hello world. I am Emic. Hear me roar.", EOM] PAUSE 2000 LOOP END ' -----[ Subroutines ]----------------------------------------------------- ' Check status of Emic TTS module ' -- wait until Busy line released by Emic ' -- code as written does not timeout Check_Busy: PAUSE 1 ' allow busy to activate DO WHILE (Busy = Yes) : LOOP ' wait until not busy RETURN