Emic 2
in BASIC Stamp
I need some help in the complete code to make a song play on a basic stamp2/emic2. I always see this but not the complete code so I can learn how it all works.
This is not the complete song just part of it .
v5
S [:phone arpa speak on][:rate 100][:n2][:dv ap 200 sm 100 ri 100 f4 4600][ow<200,18>ow<200,15> sey<400,11> kae<400,15>nyu<400,18>w siy<600,23> _<300> bay<350,27> dhah<50,25> dao<400,23>nz rr<400,15>lliy<400,17> llay<600,18>t _<300> wah<200>t sow<200> praw<600,27>dlliy<200,25> wiy<400,23>hxey<400,22>eld _<300> ae<lldheh<600,18>r _<300> ow<400> sey<400,23> dah<400>z dhae<200,23>ae<200,22>tstah<400,20>r spae<400>ngel<400>d bae<400,25>nrr<200,28>rr<200,27>yxeh<200,25>eh<200,23>t wey<800,23>ey<150,25>ey<150,23>ey<1200,22>v _<900>fow<300,18>rdhah<300> llae<900,23>ae<400,25>nd ah<300,27>v dhah<300,28>friy<1000,30>iy<1000,35> _<900> ae<300,23>nd dhah<300,25> hxow<1000,27>m _<600>ah<300,28>v dhah<1000,25> brrey<1500,23>v _<900>][:n0]
This is not the complete song just part of it .
v5
S [:phone arpa speak on][:rate 100][:n2][:dv ap 200 sm 100 ri 100 f4 4600][ow<200,18>ow<200,15> sey<400,11> kae<400,15>nyu<400,18>w siy<600,23> _<300> bay<350,27> dhah<50,25> dao<400,23>nz rr<400,15>lliy<400,17> llay<600,18>t _<300> wah<200>t sow<200> praw<600,27>dlliy<200,25> wiy<400,23>hxey<400,22>eld _<300> ae<lldheh<600,18>r _<300> ow<400> sey<400,23> dah<400>z dhae<200,23>ae<200,22>tstah<400,20>r spae<400>ngel<400>d bae<400,25>nrr<200,28>rr<200,27>yxeh<200,25>eh<200,23>t wey<800,23>ey<150,25>ey<150,23>ey<1200,22>v _<900>fow<300,18>rdhah<300> llae<900,23>ae<400,25>nd ah<300,27>v dhah<300,28>friy<1000,30>iy<1000,35> _<900> ae<300,23>nd dhah<300,25> hxow<1000,27>m _<600>ah<300,28>v dhah<1000,25> brrey<1500,23>v _<900>][:n0]

Comments
' ========================================================================= ' ' File....... Emic2_Demo.bs2 ' Purpose.... Demonstration of the Emic 2 Text-to-Speech Module ' Author..... Joe Grand, Grand Idea Studio, Inc. [www.grandideastudio.com] ' E-mail..... support@parallax.com ' Updated.... 10 SEP 2015 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' This program provides a simple demonstration of the Emic 2 Text-to-Speech ' Module. Please refer to the product manual for full details of system ' functionality and capabilities. ' ' -----[ Revision History ]------------------------------------------------ ' ' 1.0: Initial release ' 1.1: Added Select Voice command and a comment about BS2 missing the ":" ' response for commands that respond quickly. ' ' -----[ I/O Definitions ]------------------------------------------------- EMIC_TX PIN 0 ' Serial output (connects to Emic 2 SIN) EMIC_RX PIN 1 ' Serial input (connects to Emic 2 SOUT) ' -----[ Constants ]------------------------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE T9600 CON 84 #CASE BS2SX, BS2P T9600 CON 240 #ENDSELECT EmicBaud CON T9600 ' -----[ Initialization ]-------------------------------------------------- Init: DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR ' when the Emic 2 powers on, it takes about 3 seconds for it to successfully ' initialize. it then sends a ":" character to indicate it's ready to accept ' commands. if the Emic 2 is already initialized, a CR will also cause it ' to send a ":" DEBUG "Waiting for Emic 2..." SEROUT EMIC_TX, EmicBaud, [CR] 'SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")] ' At 9600 baud, the BS2 misses the Emic 2's response for commands that respond quickly DEBUG "Ready!", CR ' -----[ Program Code ]---------------------------------------------------- Main: DEBUG "Changing my voice..." SEROUT EMIC_TX, EmicBaud, ["N1", CR] ' Send command 'SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' At 9600 baud, the BS2 misses the Emic 2's response for commands that respond quickly DEBUG "Done!", CR PAUSE 250 ' Short delay DEBUG "Speaking some text..." SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR] ' Send the desired string to convert to speech SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command DEBUG "Done!", CR PAUSE 500 ' Short delay DEBUG "Singing a song..." SEROUT EMIC_TX, EmicBaud, ["V5"] SEROUT EMIC_TX, EmicBaud, ["S"] SEROUT EMIC_TX, EmicBaud, [:phone arpa speak on][:rate 100][:n2][:dv ap 200 sm 100 ri 100 f4 4600][ow<200,18>ow<200,15> sey<400,11> kae<400,15>nyu<400,18>w siy<600,23> _<300> bay<350,27> dhah<50,25> dao<400,23>nz rr<400,15>lliy<400,17> llay<600,18>t _<300> wah<200>t sow<200> praw<600,27>dlliy<200,25> wiy<400,23>hxey<400,22>eld _<300> ae<lldheh<600,18>r _<300> ow<400> sey<400,23> dah<400>z dhae<200,23>ae<200,22>tstah<400,20>r spae<400>ngel<400>d bae<400,25>nrr<200,28>rr<200,27>yxeh<200,25>eh<200,23>t wey<800,23>ey<150,25>ey<150,23>ey<1200,22>v _<900>fow<300,18>rdhah<300> llae<900,23>ae<400,25>nd ah<300,27>v dhah<300,28>friy<1000,30>iy<1000,35> _<900> ae<300,23>nd dhah<300,25> hxow<1000,27>m _<600>ah<300,28>v dhah<1000,25> brrey<1500,23>v _<900>][:n0] SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command DEBUG "Done!", CR DEBUG CR, "Demonstration complete!" END ' -----[ Subroutines ]----------------------------------------------------- No_Response: ' if we get here, it means we did not receive a ":" from the Emic 2 DEBUG "No response!", CR, CR, "Ending demonstration!" END ' -----[ End of File ]----------------------------------------------------I normally work with the emic2 using a propeller and its SPIN language, so the above code may or may not work, give it a try...
SEROUT EMIC_TX, EmicBaud, [:phone arpa speak ON][:rate 100][:n2][:dv ap 200
!
Thanks Bob
You have some parameters that may not be supported by EMIC2...
know what it is
Thanks
Bob
SEROUT EMIC_TX, EmicBaud, ["P0", CR]
Lots more info - http://www.grandideastudio.com/emic-2-text-to-speech-module
Needs some help
Thanks
Bob
I see that you are trying to play the Star Spangled Banner -
I think your problem may just be a syntax error in the EMIC data - look like you copied incorrectly.
Specifically this piece "ae<lldheh<600,18>r> ...
If the syntax is incorrect, you will get errors. Try playing small pieces that work and keep adding more data - if you get an error it will be easier to find..
From the EMIC2 documentation:
I realize it probably is just a syntax is incorrect but that's what I need is the correct programing to make it work. Just like the song above.
I don't know how to make it play because I have not seen the correct lines of code to make it work on a basic stamp2
Thanks for all your help
Thanks,
Bob
SEROUT EMIC_TX, EmicBaud, ["P0", CR]["
^
Don't forget the "S" at the beginning of "S[:phone arpa speak on]"....
' ========================================================================= ' ' File....... Emic2_Demo.bs2 ' Purpose.... Demonstration of the Emic 2 Text-to-Speech Module ' Author..... Joe Grand, Grand Idea Studio, Inc. [www.grandideastudio.com] ' E-mail..... support@parallax.com ' Updated.... 14 FEB 2012 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' This program provides a simple demonstration of the Emic 2 Text-to-Speech ' Module. Please refer to the product manual for full details of system ' functionality and capabilities. ' ' -----[ Revision History ]------------------------------------------------ ' ' 1.0: Initial release ' ' -----[ I/O Definitions ]------------------------------------------------- EMIC_TX PIN 0 ' Serial output (connects to Emic 2 SIN) EMIC_RX PIN 1 ' Serial input (connects to Emic 2 SOUT) ' -----[ Constants ]------------------------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE T9600 CON 84 #CASE BS2SX, BS2P T9600 CON 240 #ENDSELECT EmicBaud CON T9600 ' -----[ Initialization ]-------------------------------------------------- Init: DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR ' when the Emic 2 powers on, it takes about 3 seconds for it to successfully ' intialize. it then sends a ":" character to indicate it's ready to accept ' commands. if the Emic 2 is already initialized, a CR will also cause it ' to send a ":" DEBUG "Waiting for Emic 2..." SEROUT EMIC_TX, EmicBaud, [CR] SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")] DEBUG "Ready!", CR ' -----[ Program Code ]---------------------------------------------------- Main: ' DEBUG "Speaking some text..." ' SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR] ' Send the desired string to convert to speech ' SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command ' DEBUG "Done!", CR PAUSE 500 ' Short delay DEBUG "Reset...", CR SEROUT EMIC_TX, EmicBaud, ["R",CR] DEBUG "Dectalk P0...", CR SEROUT EMIC_TX, EmicBaud, ["P0",CR] DEBUG "Singing...", CR SEROUT EMIC_TX, EmicBaud, ["S[:phone arpa speak on][:rate 200][:n0][dey<650,22>ziy<600,19> dey<650,15>ziy<600,10> gih<200,12>v miy<200,14> yurr<200,15> ae<400,12>nsax<200,15>r duw<750,10> _<400,10>][:n0][ay<600,17>m hxae<500,22>f kr ey<650,19>ziy<600,15> ao<200,12>ll fao<200,14>r dhax<200,15> llah<400,17>v ao<200,19>v yu<750,17> _<400,17>][:n0][ih<200,19>t wow<200,20>nt biy<200,19> ax<200,17> stay<500,22>llih<200,19>sh mae<350,17>rih<400,15>jh<150,15>][:n0][ay<200,17> kae<400,19>nt ax<200,15>fow<400,12>rd ax<200,15> kae<350,12>rih<400,10>jh<150,10>][:n0][bah<200,10>t yu<500,15>d lluh<200,19>k swiy<400,17>t ah<200,10>p ao<500,15>n dhax<200,19> siy<200,17>t ao<200,17>v ah<200,19> bay<200,22>six<200,19>kel<200,15> bih<400,17>llt fao<200,10>r tuw<800,15>][:n0]",CR] SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command DEBUG "Done!", CR DEBUG CR, "Demonstration complete!" END ' -----[ Subroutines ]----------------------------------------------------- No_Response: ' if we get here, it means we did not receive a ":" from the Emic 2 DEBUG "No response!", CR, CR, "Ending demonstration!" END ' -----[ End of File ]----------------------------------------------------Thanks So Much!
Bob
From one old retired guy to another!
Wrong forum!!!
There may be an Arduino forum somewhere with members as smart, friendly and helpful as you find here.
But I doubt it.
I guess your Google button is broke?
https://www.parallax.com/downloads/emic-2-arduino-example-code
We're REALLY friendly and helpful here!
Actually Parallax has an Arduino code example for the EMIC 2 here:
https://www.parallax.com/downloads/emic-2-arduino-example-code
See two posts above.
Thanks,
Bob
Opps! Missed that - sorry...
Bob -it is same principle - you are sending a text string to the EMIC 2
Just replace the first string with the second...
emicSerial.print("Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song."); // Send the desired string to convert to speech emicSerial.print("[:phone arpa speak on][:rate 200][:n0][dey<650,22>ziy<600,19> dey<650,15>ziy<600,10> gih<200,12>v miy<200,14> yurr<200,15> ae<400,12>nsax<200,15>r duw<750,10> _<400,10>][:n0][ay<600,17>m hxae<500,22>f kr ey<650,19>ziy<600,15> ao<200,12>ll fao<200,14>r dhax<200,15> llah<400,17>v ao<200,19>v yu<750,17> _<400,17>][:n0][ih<200,19>t wow<200,20>nt biy<200,19> ax<200,17> stay<500,22>llih<200,19>sh mae<350,17>rih<400,15>jh<150,15>][:n0][ay<200,17> kae<400,19>nt ax<200,15>fow<400,12>rd ax<200,15> kae<350,12>rih<400,10>jh<150,10>][:n0][bah<200,10>t yu<500,15>d lluh<200,19>k swiy<400,17>t ah<200,10>p ao<500,15>n dhax<200,19> siy<200,17>t ao<200,17>v ah<200,19> bay<200,22>six<200,19>kel<200,15> bih<400,17>llt fao<200,10>r tuw<800,15>][:n0]");and delete this line " emicSerial.print("D1\n");"
Bob