Text to Speech Block on Activity WX board

Should the Text to Speech block work with the Activity WX Board? The block shows up and appears to set code up properly. The docs say it will not work with it.
Here is the C code generated.
// ------ Libraries and Definitions ------
#include "simpletools.h"
#include "text2speech.h"

// ------ Global Variables and Objects ------
talk * tts_talk;



// ------ Main Program ------
int main() {
  tts_talk = talk_run(26, 27);
  talk_set_speaker(tts_talk, 1, 100);
  while (1) {
    talk_say(tts_talk, "heloa");
  }

}

It looks like it should work, it sets the audio output pins to 26 and 27 which go to the audio jack on the activity wx board.
When I run the program the led's for pin 26 and 27 glow slightly.

Comments

  • 17 Comments sorted by Date Added Votes
  • Put a speaker or headphones into the jack; you will hear the TTS.

    The speaker I/O pin is shared with the LED.

    Ken Gracey
  • ShawnaShawna Posts: 375
    edited September 21 Vote Up0Vote Down
    Haha, Ok I'm not that dense, maybe! lol
    I have a veho360 speaker plugged into the jack and I hear nothing. I have used the "wave play file" block so I know the jack works.
    But now I know it should work, I will dig deeper.

    Thanks
  • Ken GraceyKen Gracey Posts: 6,285
    edited September 21 Vote Up0Vote Down
    I'll put together an example for you. TTS isn't something we've used much (figuring out how to assemble a word from those phonemes is the difficult part I've not researched). Will go make an example and post it here. TTS does not use the SD card, too. - Ken Gracey
  • ShawnaShawna Posts: 375
    edited September 21 Vote Up0Vote Down
    Thanks Ken,

    Does the Text to Speech block start a new cog, the reference page does not indicate it does?

    The reason I ask is because of this code I tried below.
    // ------ Libraries and Definitions ------
    #include "simpletools.h"
    #include "text2speech.h"
    
    // ------ Global Variables and Objects ------
    talk * tts_talk;
    
    
    
    // ------ Main Program ------
    int main() {
      tts_talk = talk_run(26, 27);
      talk_set_speaker(tts_talk, 1, 100);
      while (1) {
        talk_say(tts_talk, "hi");
        high(8);
        pause(2000);
        low(8);
        pause(2000);
      }
    
    }
    

    Pin 26 and 27 are lit constantly, however I think that they should be off for about 4 seconds as the code goes through the pause statements.

  • Yes, it starts a new processor. I call cogs "processors" when working with the BlocklyProp crowd, in case anybody reads this post. Because it starts another processor, the LEDs on 26/27 would probably stay on while "hi" is being spoken.
  • Ken GraceyKen Gracey Posts: 6,285
    edited September 21 Vote Up0Vote Down
    Try this in Simple IDE:
    #include "simpletools.h"                     // Include simpletools library
    #include "text2speech.h"                     // Include text2speech library
    
    talk *tts_talk;                                  // Talk process ID/data pointer
    
    // ------ Main Program ------
    int main() {
      tts_talk = talk_run(0,27);
      talk_set_speaker(tts_talk, 1, 100);
      talk_say(tts_talk, "Andee");
      pause(2000);
      talk_say(tts_talk, "Linsee");
      pause(1000);
    
    }
    

    We seem to have a problem in the BlocklyProp generated code. Andy and I are looking through it at the moment. For now, you can use BlocklyProp to generate the code, and change it to have the correct talk_run parameters of 0,27. While this works, we need to do further work on the C library so P0 is not used.

    Ken Gracey
  • So, if I put my ear next to the veho360 speaker, I hear static continually. Every 4 seconds it does say something but I cannot make it out! The static would explain why pin 26 and 27 are lit up constantly.
  • ShawnaShawna Posts: 375
    edited September 21 Vote Up0Vote Down
    I would assume that the leds tied to pins 26 and 27 should be off during the 4 second pause. It doesn't take four seconds to say "Hi".

    I will try it!
    Thanks
  • Shawna wrote: »
    I would assume that the leds tied to pins 26 and 27 should be off during the 4 second pause. It doesn't take four seconds to say "Hi".

    I will try it!
    Thanks

    That's right - you should hear the "Hi" right away. But this word needs to be spelled out as phonemes and we've not posted any documentation on how to do that. The Learn folder which has the source code likely includes Phil Pilgrim's original Spin code, which has the correct phonemes to use.

    Since you posted this thread, Andy and I went spent yesterday evening sorting out the issue. He made a new C library which works correctly - with volume control. I have to test it on Monday morning and then we'll push it all to Blockly and you can try it out. We will need to document the TTS blocks, too.

    As soon as we've got it posted on demo.blockly.parallax.com I'll let you know.

    Ken Gracey
  • I tried the code you posted and it works. Thank you for looking into it Ken, I think that the text to speech would be a fun thing for kids to add to their projects. I won't lie, I want to play with it also.

    Thanks Again
  • Shawna wrote: »
    I won't lie, I want to play with it also.

    :-)
    Whit+

    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • edited September 24 Vote Up0Vote Down
    After a few library updates (remove caveats from talk_run and add volume control), I posted a block update request -issue 1554 on the BlocklyProp GitHub repository.
  • Thanks Andy, I am looking forward to experimenting with it tonight.
  • Shawna wrote: »
    I tried the code you posted and it works. Thank you for looking into it Ken, I think that the text to speech would be a fun thing for kids to add to their projects. I won't lie, I want to play with it also.

    Thanks Again

    I want to play with it also. Phil Pilgrim has been way ahead of so many of us with this project. It should be a lot of fun to do more TTS with such minimal hardware. Andy and I will get the code, reference and examples straight over the coming weeks so we can all build talking robots.

    Ken Gracey
  • I've also tried Ken's code and was able to get it to say some other words. It is not that difficult to make new words using the list of phonemes in the talk_say documentation. See code below.
    #include "simpletools.h"                     // Include simpletools library
    #include "text2speech.h"                     // Include text2speech library
    
    talk *tts_talk;                                  // Talk process ID/data pointer
    
    // ------ Main Program ------
    int main() 
    {
    
      tts_talk = talk_run(0,27);
      talk_set_speaker(tts_talk, 1, 100);
      talk_say(tts_talk, "%");
        while(1)
      {
      talk_say(tts_talk, "paramaks");
      pause(2000);
      talk_say(tts_talk, "proa 'pel 'ir");
      pause(2000);
      }
    }
    
    I did notice a couple of issues. The documentation says the third parameter in talk_set_speaker() should change pitch. I didn't notice any change using values from 50 to 2000.

    Also, "l", "al", "el" don't sound like L, AL, or EL, but sound like the L was replaced with M. To get the L sound, I had to use M (parallax = paramaks). I did try the original spin demos & "l", "al", "el" sounded correct.

    It is a fun library to use.

    Tom
  • Tom,

    Cool!

    This worked for me... for "Parallax"
    /*
      TextToSpeech.c
      http://learn.parallax.com/propeller-c-tutorials 
    */
    #include "simpletools.h"                     // Include simpletools library
    #include "text2speech.h"                     // Include text2speech library
    
    talk *tts_talk;                                  // Talk process ID/data pointer
    
    // ------ Main Program ------
    int main() 
    {
    
      tts_talk = talk_run(0,27);
      talk_set_speaker(tts_talk, 1, 100);
      talk_say(tts_talk, "%");
        while(1)
      {
      talk_say(tts_talk, "par 'el 'aks");
      pause(2000);
      talk_say(tts_talk, "proa 'pel 'ir");
      pause(2000);
      }
    }
    
    Whit+

    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • Yeah, after playing around with it for a while, I found that it does work pretty well!
    I ended up buying this from the parallax shop.

    It works good also.

    Emic 2 Text-to-Speech Module

    https://parallax.com/product/30016
Sign In or Register to comment.