emic text to speech module
Robban
Posts: 124
Hi!
Just got my emic text to speech and i am very impressed...
But....i am trying to make it say a value..generated from a SRF04 distance sensor
but i didn´t make it to work..so i tried to do a simple program (shown bellow)
Say············ CON···· $00···················· ' say Engish text
Volume········· CON···· $06···················· ' set volume, 0 - 7
Speed·········· CON···· $04···················· ' 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
cmd············ VAR···· Byte···················· ' end of message
a············· VAR··· Word
OK············· CON···· $55···················· ' "okay" for hex mode
a=123
Main:
··· SEROUT 0, 396, [noparse][[/noparse]Say, a, EOM]
··· PAUSE 2000
· END
as you can see, i want it to say the a variable (123)
Anybody got a clue?
Robert
Just got my emic text to speech and i am very impressed...
But....i am trying to make it say a value..generated from a SRF04 distance sensor
but i didn´t make it to work..so i tried to do a simple program (shown bellow)
Say············ CON···· $00···················· ' say Engish text
Volume········· CON···· $06···················· ' set volume, 0 - 7
Speed·········· CON···· $04···················· ' 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
cmd············ VAR···· Byte···················· ' end of message
a············· VAR··· Word
OK············· CON···· $55···················· ' "okay" for hex mode
a=123
Main:
··· SEROUT 0, 396, [noparse][[/noparse]Say, a, EOM]
··· PAUSE 2000
· END
as you can see, i want it to say the a variable (123)
Anybody got a clue?
Robert
Comments
You will have to use the DEC modifier.
SEROUT 0, 396, [noparse][[/noparse]Say, DEC a, EOM]
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I reject my reality, and substitute yours." NOT Mythbusters
·
now for another quiestion
if the distance is lower than 40 cm i want it to say "Warning"
if the distance is higher tan 40 but lower than 100 i want it to say "Caution"
here is the program i have ..
Tx PIN 0 ' connects to Emic SIn
Rx PIN 1 ' connects to Emic SOut
Busy PIN 2 ' 1 = busy
Rst PIN 3
'
[noparse][[/noparse] 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 $07 ' 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
vol VAR Nib ' current volume
spd VAR Nib ' current speed
ptch VAR Nib
'
[noparse][[/noparse] Program Code ]
convfac CON 29
wDist VAR Word
INIT CON 15
ECHO CON 14
' CONVERSION FACTORS:
GOSUB hard_reset
'
[noparse][[/noparse] Program Code ]
Main:
GOSUB sr_sonar_2
GOSUB Check_Busy
SEROUT Tx, Baud, [noparse][[/noparse]Say,"Distance to target is:", DEC wdist, " centimeters", EOM]
DEBUG DEC wdist, CR
PAUSE 1000
GOTO main
sr_sonar_2:
DO
PULSOUT INIT,5 ' 10us init pulse
OUTPUT INIT ' dummy command (delay)
RCTIME ECHO,1,wDist ' measure echo time
wDist=wDist/convfac ' convert to inches
PAUSE 10
RETURN
PAUSE 2000
LOOP
Check_Busy:
PAUSE 1 ' allow busy to activate
DO WHILE (Busy = Yes) : LOOP ' wait until not busy
RETURN
Hard_Reset: ' reset to default values
LOW Rst ' pull reset line low
PAUSE 0 ' ~100 uS pause
INPUT Rst ' let reset float
GOSUB Wait_OK
RETURN
Wait_OK:
SERIN Rx, Baud, 1000, TO_Error, [noparse][[/noparse]WAIT(OK)]
RETURN
TO_Error:
DEBUG CLS, "No response from Emic TTS." ' ruh-roh, Shaggy
END
Soft_Reset:
GOSUB Check_Busy ' wait for busy to release
SEROUT Tx, Baud, [noparse][[/noparse]Reset, EOM] ' send soft reset
GOSUB Wait_OK
vol = 7 ' set pgm vars to defaults
spd = 2
ptch = 1
RETURN