Announcement

Collapse
No announcement yet.

Tasker TTS with sound

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Tasker TTS with sound

    I'm brand new to Tasker (and HS). I somehow managed to get Tasker to speak text on an old Android phone. However, I can't figure out how to get it play any sounds using the HS3 SAY task. My understanding is that adding <alarm> or <system> should play a sound that is built into the phone (see photo 1). I don't know how to select those sound files. When I go into Task Edit (see photo 2), I see red vertical bars which I am guessing means that something needs to be defined. But when I go into Action Edit, I don't see anything that would allow me to define a sound file.

    I was able to create a test Task with Action-Notify Sound. This let me pick a Sound File and plays that sound.

    I'm totally missing something
    Attached Files

    #2
    Hi Fcol, welcome aboard.

    SAY task can only be used for Text to speech. The different tags is used to direct the speech to the android mixer. Ex. if you at night have multimedia volume down you can still send alarm message to sound at night etc.
    To play a soundfile you need to store it under Tasker/soundfiles and trigger the command by custom command.
    Ex. play=yoursoundfile.mp3
    or
    play=http://static1.grsites.com/archive/sounds/cartoon/cartoon180.wav
    When using url it will also save the souldfile under Tasker/soundfiles
    Please excuse any spelling and grammatical errors I may make.
    --
    Tasker Plugin / Speech Droid
    Tonlof | Sweden

    Comment


      #3
      Hi I have been trying to use the tts service etc and I have followed all the instructions for setting up tasker to connect to the plugin etc.
      I can choose my device and the action of 'text to speech' but It doesn't load the extra box for 'set device string to' meaning I can't actually type anything in to send. It doesn't come up the device string box on any of the other commands either e.g. Send custom URL etc.

      Am I doing something obviously wrong?

      Sent from my ONEPLUS A3003 using Tapatalk

      Comment


        #4
        Originally posted by mastermixlee View Post
        Hi I have been trying to use the tts service etc and I have followed all the instructions for setting up tasker to connect to the plugin etc.
        I can choose my device and the action of 'text to speech' but It doesn't load the extra box for 'set device string to' meaning I can't actually type anything in to send. It doesn't come up the device string box on any of the other commands either e.g. Send custom URL etc.

        Am I doing something obviously wrong?

        Sent from my ONEPLUS A3003 using Tapatalk
        Hello mastermixlee, this is not related to Tasker plugin only it's a common HS3 advance settings. I guess you have the red icon with a airplane and if you hover it will say advance options. Just click on it and it will open the extra textfield.
        Attached Files
        Please excuse any spelling and grammatical errors I may make.
        --
        Tasker Plugin / Speech Droid
        Tonlof | Sweden

        Comment


          #5
          I did wonder what that was but didn't think it was a button lol. Thanks so much for the quick reply!!

          Sent from my ONEPLUS A3003 using Tapatalk

          Comment


            #6
            Originally posted by tonlof View Post
            To play a soundfile you need to store it under Tasker/soundfiles and trigger the command by custom command.
            Ex. play=yoursoundfile.mp3
            or
            play=http://static1.grsites.com/archive/sounds/cartoon/cartoon180.wav
            When using url it will also save the souldfile under Tasker/soundfiles
            Thanks! I was able to get sound to play when I used your play=http example (and I see cartoon 180.wav get copied into Tasker/soundfiles). But I can't get it to play the file locally using play=cartoon180.wav. In fact, the test Task I made to play a Notify Sound stops working until I reboot the phone. But once I send the custom code play=cartoon180.wav, then I can't get Tasker to play sounds anymore. I'll find another tablet and see how that works.

            Comment


              #7
              Originally posted by fcol View Post
              Thanks! I was able to get sound to play when I used your play=http example (and I see cartoon 180.wav get copied into Tasker/soundfiles). But I can't get it to play the file locally using play=cartoon180.wav. In fact, the test Task I made to play a Notify Sound stops working until I reboot the phone. But once I send the custom code play=cartoon180.wav, then I can't get Tasker to play sounds anymore. I'll find another tablet and see how that works.
              Could you check line 10 in tasker TASK PLAY if this line is disabled.
              Try to enable it and see if it works better.
              Please excuse any spelling and grammatical errors I may make.
              --
              Tasker Plugin / Speech Droid
              Tonlof | Sweden

              Comment


                #8
                Originally posted by tonlof View Post
                Could you check line 10 in tasker TASK PLAY if this line is disabled.
                Try to enable it and see if it works better.
                That worked - thanks!

                Comment


                  #9
                  Now I'm trying to script a sound (mp3) followed by TTS:
                  Code:
                  Public Sub Main(ByVal Parms As Object) 
                  hs.PluginFunction("Tasker Plugin", "", "CustomAPI", New Object() {"EvoAR", "PLAY", "meta.mp3"})
                  hs.waitsecs(2)
                  hs.PluginFunction("Tasker Plugin", "", "CustomAPI", New Object() {"EvoAR", "SAY ", "Hello this is a message"})
                  End Sub
                  I'm seeing this error pop up on the Android phone:
                  "Error. Music Play: file not found: /storage/sdcard0/Tasker/Soundfiles/%commands2."

                  I am guessing this means I placed "meta.mp3" in the wrong place (Sorry but I don't have a software background)? After this error pops up, the phone does successfully speak the text.


                  This may not be related but if I try to play a sound via an Event-Custom Code-play=meta.mp3, then it always gives this error in the HS3 log.

                  Dec-20 23:26:37 Tasker Plugin Error ----------------------------------------------------------------------
                  Dec-20 23:26:37 Tasker Plugin Error Connection Error
                  Dec-20 23:26:37 Tasker Plugin Error ----------------------------------------------------------------------
                  Dec-20 23:26:37 Tasker Plugin Error Sending local command failed: (192.168.254.122)

                  Sometimes it successfully plays the sound and sometimes it doesn't play the sound. But it always shows this connection error. If I use the Tasker plug-in Text-to-Speech field, then that seems to work fine (no connection errors). But playing the sound (via custom code play=) is very inconsistent. This is why I am trying the script since I don't see the connection error when running a script for the Tasker Plugin. I do have remote access for MyHS enabled (although I really would rather not since I prefer to keep all Home Automation traffic on my LAN).

                  Comment


                    #10
                    Hi, try
                    PHP Code:
                    hs.PluginFunction("Tasker Plugin""""CustomAPI", New Object() {"EvoAR""PLAY=meta.mp3"""})
                    and if 
                    you need both 
                    hs
                    .PluginFunction("Tasker Plugin""""CustomAPI", New Object() {"EvoAR""PLAY=meta.mp3 SAY""Hello this is a message"}) 
                    Your phone wifi may go to sleep and does not respond on wifi and thats why you get connection error. The plugin try to make several local connection if local ip is added to the android device, if no local connection it will send the command through cloud.
                    Please excuse any spelling and grammatical errors I may make.
                    --
                    Tasker Plugin / Speech Droid
                    Tonlof | Sweden

                    Comment


                      #11
                      Originally posted by tonlof View Post
                      The plugin try to make several local connection if local ip is added to the android device, if no local connection it will send the command through cloud.
                      A little off topic, but I quite often have delayed TTS messages, sometimes by a few minutes.

                      I very often have errors similar to this in my log:


                      Dec-20 23:26:37 Tasker Plugin Error ----------------------------------------------------------------------
                      Dec-20 23:26:37 Tasker Plugin Error Connection Error
                      Dec-20 23:26:37 Tasker Plugin Error ----------------------------------------------------------------------
                      Dec-20 23:26:37 Tasker Plugin Error Sending local command failed: (192.168.254.122)


                      would that explain the delays, that tasker unsuccessfully tries to connect locally, then goes via the cloud ?
                      My tablets are wall mounted and connected to my wifi to permanently display cameras, and they never loose connection but tasker still shows this error in the HS3 logs

                      Comment


                        #12
                        Originally posted by tonlof View Post
                        Hi, try
                        PHP Code:
                        hs.PluginFunction("Tasker Plugin""""CustomAPI", New Object() {"EvoAR""PLAY=meta.mp3"""})
                        and if 
                        you need both 
                        hs
                        .PluginFunction("Tasker Plugin""""CustomAPI", New Object() {"EvoAR""PLAY=meta.mp3 SAY""Hello this is a message"}) 
                        Your phone wifi may go to sleep and does not respond on wifi and thats why you get connection error. The plugin try to make several local connection if local ip is added to the android device, if no local connection it will send the command through cloud.
                        Thanks - this code does work. But there's something screwy with my setup. When I first tried the new script, it would only play the sound and not play the TTS. I tried the SAY command by itself (using script method and using Tasker plugin built-in Event Text-to-Speech) and it still wouldn't do TTS. I tried many combinations but it would only play sound. After opening Tasker on the phone, then it would play both sound and TTS.

                        The PLAY command always generates that Connection Error. If I change the script to only contain the SAY command, then there's no Connection Error. (Even when the phone wasn't playing the TTS, the HS3 log showed no Connection Error). I guess there's something going on with Tasker on the phone. I was having trouble with Pushover and using Tasker to convert Pushover notifications to TTS. The Pushover notifications always played their sound. But Tasker would only play the TTS sometimes.

                        I'm pretty sure my WiFi is not asleep since 1) it receives Pushover traffic 100% and 2) I have this same problem (with Tasker TTS) when using microUSB-to-ethernet. I've been using the app Phone Schedule to auto-launch Tasker and AutoRemote every hour and that seems to help but I think I need to auto-launch more often (every 15 min?). The HTC Evo phone is running Android 4.1.1. Perhaps it is aggressively shutting down Tasker or other background tasks? But that wouldn't explain why Pushover always works.
                        [Sorry if this is off-topic for the Tasker HS3 plugin - I suppose I could move to an Android Tasker forum? But perhaps other people are having trouble with TTS and HS3...]

                        Comment


                          #13
                          Originally posted by fcol View Post
                          Perhaps it is aggressively shutting down Tasker or other background tasks? But that wouldn't explain why Pushover always works.
                          After some research, it seems like this phone (and many phones) might have power saving features that interfere with network connections. But Google Cloud Messaging (GCM) is exempt from these power saving features and therefore will allow services like Pushover to work. I don't think this explains why Android Tasker SAY command isn't speaking the Pushover messages half of the time (since I think the Android Tasker app should just be running locally on the phone and shouldn't care about a network connection).

                          Comment


                            #14
                            If you are using Android 6 or later, be sure that power saving is disabled for Tasker, Autoremote or any other 3rd part tts engine.
                            Please excuse any spelling and grammatical errors I may make.
                            --
                            Tasker Plugin / Speech Droid
                            Tonlof | Sweden

                            Comment


                              #15
                              I'm using Ivona on Android 4.1.1 and 4.4.2. I don't see a way to turn off power saving for Ivona. But I'll switch to the built-in TTS voice. If Ivona is going to sleep, then this would explain why other non-TTS Tasker events are working but the TTS doesn't always work. Thanks!

                              Comment

                              Working...
                              X