Announcement

Collapse
No announcement yet.

playwavfile ... doesn't wait until wav is finished?

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

    playwavfile ... doesn't wait until wav is finished?

    Not sure if this should be put in here.. or the script forum... Moderators.. feel free to move if it is better somewhere else.

    THe playwavfile command seems to ignore the "wait until finished" flag..

    Code:
     hs.Speak("testing 1 . 2 . 3 . 4 . 5 . . . ",True, "*")
    hs.PlayWavFile("C:\Program Files (x86)\HomeSeer HS3\messages\" & MFileName,"*",True)
    hs.Speak("testing 1 . 2 . 3 . 4 . 5 . . . ",True, "*")
    For the above code

    All three produce the desired audio.. <Good!!!>

    But...

    the first hs.speak... speaks and waits before it begins playing the wav file. <as expected>

    The hs.playwavfile begins playing the appropriate wav file. <as expected>

    The third hs.speak starts speaking imediately after the wav file begins playing... both coming out of speaker client at same time. <not as expected>

    what am i missing?

    Any help is appreciated.. thank you
    Regards,

    Andrew B.

    #2
    Just an FYI in case anyone wants to try it..
    Paste the following into an imediate script window.. (change the filename to a mp3 or wav file on your system).. and you'll see what i'm talking about

    Code:
    &hs.Speak "testing 1 . 2 . 3 . 4 . 5 . . . ",True, "*" : hs.PlayWavFile "C:\Program Files (x86)\HomeSeer HS3\messages\2016-08-21_06-45-16.mp3","*",True :hs.Speak "testing 1 . 2 . 3 . 4 . 5 . . . ",True, "*"
    I gotta admint.. it's got me stymied...
    Regards,

    Andrew B.

    Comment


      #3
      Workaround found

      I figured out how to have HS wait for a wav file to complete...

      Code:
      		     retval = hs.URLAction("http://" & HSNAME & "/hspw?no_page_gen=1&doaction=playspkr&playfile=" & MFileName, "GET", "", "")
                        
         
                          hs.WaitSecs(4)
                          do while hs.MEDIAIsPlaying
                            'wait for wav to finish
                          loop
      Wav file is typically 30 seconds long... (ranges from 4 - 90 seconds)

      The wait 4 seconds seems to be needed because for some reason.. there is a couple second lag between when the wav file starts playing.. and when hs.MEDIAIsPlaying is set to true..

      it works... but it is truly a workaround... and deals with the symptom rather than the problem. (Playwavfile not working as expected)

      Is this something that should be noted in a bug report somewhere? .. if so.. let me know and i can do a bugzilla (assuming i can find where it is on the site)

      Thanks
      Regards,

      Andrew B.

      Comment


        #4
        I have no waiting on the HS3 Pro machine and waiting on the HS3 lite machine. The HS3 Pro machine plays the wave file fine then does the TTS. Both HS3 Pro and HS3 Lite are running HS3 V.291.

        What are you running on? Windows or Linux? What version of HS3 are your running? Thinking I did put the wait between the wave file and speak because of the same reason you have mentioned way back.

        You can also speak the wave file if you want.

        Just tested it with and without waiting on the HS3 lite machine and it works fine. The new HS3 lite (old Zee-2) was switched over to a mini computer running Ubuntu 16.04 64bit from Wheezy on RPi2. I do not think the change from an Arm CPU to an AMD CPU would make a difference though. (or from Wheezy to Ubuntu).
        Attached Files
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
        HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

        HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

        Comment

        Working...
        X