Shop OBEX P1 Docs P2 Docs Learn Events
Emic 2 — Parallax Forums

Emic 2

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]

Comments

  • Try the following code, which is a modification of the emic2 demo code with your song inserted into the section that demonstrates singing:
    ' =========================================================================
    '
    '   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...
  • I try running this code and as soon as it gets to the song part it gives me error codes. (Expected Constant,Variable,unary operator,or '('
    SEROUT EMIC_TX, EmicBaud, [:phone arpa speak ON][:rate 100][:n2][:dv ap 200
    !
    Thanks Bob
  • Have you tried starting with the version of Star Spangled Banner in the EMIC2 Documentation?
    You have some parameters that may not be supported by EMIC2...
  • I have tried but I can't any of the DECtalk Parser codes to work. I know it is some simple command that I need to insert but just don't
    know what it is
    Thanks
    Bob
  • According to the EMIC2 Documentation the codes are only a sub-set of the DEC-talk codes...
  • I just can't get this code to work with a emic2 and a basic stamp2 every time it gets to the song playing line it gives a error
    Needs some help
    Thanks
    Bob
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2017-05-09 17:02
    usabob01 wrote: »
    I just can't get this code to work with a emic2 and a basic stamp2 every time it gets to the song playing line it gives a error

    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:
    Singing “The Star-Spangled Banner”
    (The text exceeds the maximum allowable 1023 characters per message, so it must be split into two messages)

    [:phone arpa speak on][:rate 100][:n0][ow<200,18>ow<200,15> sey<400,11> kae<400,15>n
    yu<400,18>w siy<600,23> _<300> bay<350,27> dhah<50,25> dao<400,23>nz rr<400,15>ll
    iy<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<300,20>t dhah<100,22> tway<400,23> llay<400>ts llae<400,18>st
    glliy<400,15>m iy<200,11>nx _<300> hxuw<300,18>z brao<100,15>d stray<400,11>ps
    ae<400,15>nd bray<400,18>t stah<600,23>rz _<300> thruw<300,27> dhah<100,25> peh<400,23>
    rrel<400,15> ah<400,17>s fay<600,18>t _<300> ow<200,18>r dhah<200,18>
    rrae<600,27>mpah<200,25>rts wiy<400,23> waa<600,22>cht wrr<300,20> sow<100,22>
    gae<400,23>llah<400>ent lliy<400,18> striy<400,15>miy<200,11>nx _<300>][:n0]

  • That is what I need help on is to be shown a playable code that will play a song or part of a song on a basic stamp2/emic2 even if its only a short piece of the song.
    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

  • DaveJensonDaveJenson Posts: 375
    edited 2017-05-09 22:43
    <deleted>
  • Yes I tried Francis Bauer code and could not make it work.
    Thanks,
    Bob

  • DaveJensonDaveJenson Posts: 375
    edited 2017-05-09 22:55
    replace your line in the singing part with this from the Documentation:
    SEROUT EMIC_TX, EmicBaud, ["P0", CR]["S"rate 100][:phone arpa speak on][:n0][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<300,20>t dhah<100,22> tway<400,23> llay<400>ts llae<400,18>stglliy<400,15>m iy<200,11>nx _<300> hxuw<300,18>z brao<100,15>d stray<400,11>psae<400,15>nd bray<400,18>t stah<600,23>rz _<300> thruw<300,27> dhah<100,25> peh<400,23>rrel<400,15> ah<400,17>s fay<600,18>t _<300> ow<200,18>r dhah<200,18>rrae<600,27>mpah<200,25>rts wiy<400,23> waa<600,22>cht wrr<300,20> sow<100,22>gae<400,23>llah<400>ent lliy<400,18> striy<400,15>miy<200,11>nx _<300>][:n0]
    
  • Thanks for the help Dave but I still get the Expected ':' or end of line error just after the ,CR on the second {

    SEROUT EMIC_TX, EmicBaud, ["P0", CR]["
    ^

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2017-05-10 02:14
    Ok - I attached a working BS2 program playing "Daisy"

    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 ]----------------------------------------------------
    
  • Works Great!!!!!!!!!!!!!!!!!! Thank all you nice and smart people for all the help. I am an old retired guy that still likes to learn new stuff.
    Thanks So Much!
    Bob
  • usabob01 wrote: »
    Works Great!!!!!!!!!!!!!!!!!! Thank all you nice and smart people for all the help. I am an old retired guy that still likes to learn new stuff.
    Thanks So Much!
    Bob

    From one old retired guy to another!
    :smile:
  • Here is the EMIC data to play Edelweiss - sounds decent
    S [:phone arpa speak on][:rate 180][:n0][:dv hs 95 br 0 as 90 ap 90 sm 90 ri 100][EY<800,15>DEL<400,18>VAY<900,25>S<300>EY<800,23>DEL<400,18>VAY<900,16>S<300>EH<800,15>VRIY<400>MOR<400>NIH<250,16>NX<150>YU<400,18>GRIY<1100,20>T<100>MIY<800,18>_<400>SMAO<500,15>LX<300>AE<250,18>N<100>D<50>WAY<1100,25>T<100>KLLIY<500,23>N<300>AE<250,18>N<100>D<50>BRAY<1100,16>T<100>YU<800,15>LLUH<300,18>K<100>HXAE<400>PIY<400,20>TUW<400,22>MIY<1000,23>TMIY<900,23>_<800>BLLAO<800,25>SAH<125,18>M<75>AH<250>V<150>SNOW<400,22>MEY<400,20>YU<400,18>BLLUW<500,15>M<300>AE<250,18>N<100>D<50>GROW<900,23>_<300>BLLUW<500,20>M<300>AE<250,23>N<100>D<50>GROW<800,25>FOR<400,23>EH<1200,22>VRR<800,18>_<400>EY<800,15>DEL<400,18>VAY<900,25>S<300>EY<800,23>DEL<400,18>VAY<900,16>S<300>BLLEH<600,15>S<200>MAY<400,18>HXOW<250>M<150>LLAE<250,20>N<100>D<50>FOR<400,22>EH<1200,23>VRR<800>][:n0]
    
  • Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.
  • ercoerco Posts: 20,257
    usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    Wrong forum!!! :)

    There may be an Arduino forum somewhere with members as smart, friendly and helpful as you find here.



    But I doubt it. :)

  • usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    I guess your Google button is broke? :)

    https://www.parallax.com/downloads/emic-2-arduino-example-code

  • ercoerco Posts: 20,257
    DOH!

    We're REALLY friendly and helpful here!
  • erco wrote: »
    usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    Wrong forum!!! :)

    There may be an Arduino forum somewhere with members as smart, friendly and helpful as you find here.

    But I doubt it. :)

    Actually Parallax has an Arduino code example for the EMIC 2 here:
    https://www.parallax.com/downloads/emic-2-arduino-example-code
  • PublisonPublison Posts: 12,366
    edited 2017-05-16 15:49
    erco wrote: »
    usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    Wrong forum!!! :)

    There may be an Arduino forum somewhere with members as smart, friendly and helpful as you find here.

    But I doubt it. :)




    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. :)


  • Publison wrote: »
    usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    I guess your Google button is broke? :)

    https://www.parallax.com/downloads/emic-2-arduino-example-code
    All that does is play you a song and does not show you the programing to play a DECtalk Parser song.
    Thanks,
    Bob

  • erco wrote: »
    usabob01 wrote: »
    Can anyone show me how to make this above song code work on a Ardino? Ron Czapala helped me get it to work on the basic stamp2.

    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 thought because I was using a emic 2 I could get some help from you good guys.
    The example just plays you a song without showing you the programming of the DECtalk Parser song.

    Actually Parallax has an Arduino code example for the EMIC 2 here:
    https://www.parallax.com/downloads/emic-2-arduino-example-code

  • Publison wrote: »

    See two posts above. :)

    Opps! Missed that - sorry...
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2017-05-16 17:16
    usabob01 wrote: »
    All that does is play you a song and does not show you the programing to play a DECtalk Parser song.
    Thanks,
    Bob


    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");"


  • Thanks again Ron for the help. I tried I thought everything but the obvious. Your Tops!!!!!!!!!!!!!!!!!
    Bob
Sign In or Register to comment.