Announcement

Collapse
No announcement yet.

amazon polly script and squeezebox

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

  • amazon polly script and squeezebox

    Hi Pcp,

    Do you think there is a way to use this scrip with your plugin?

    here is the thread: https://forums.homeseer.com/forum/ho...g-amazon-polly

  • #2
    You mean invoke this script when a message should be spoken to create the audio file to be spoken (instead of using hs.SpeakToFIle API currently used)`? I am not familiar with Amazon Polly nor would have a way to test it. But before this can you clarify if the script would be called for a specific Squeezebox player? Is this for Linux only or WIndows as well (the script is referring to Linux shells)? I need to think about this a bit further.

    Comment


    • #3
      I am now using it with texttofile with airplayspeak plugin. Like you can see in the orher thread.

      i was wondering if it was possible to alter the texttofile.sh to make it work with your plugin.


      But the output of the script in àready a mp3 file. So i do not know how to go further.


      This would be for linux only. The script can be called from a speak command. The sccript is already called in the speak to file . Sh

      sorry is i missundersttood your questions

      Comment


      • #4
        I will have to ‘study’ this better understand. The plugin does not call texttofile.sh nor part of the plugin. I believe this is what HS3 is calling / using when an script or plugin calls the HS3 API hs.SpeakToFile (doc at https://www.homeseer.com/support/hom...peaktofile.htm) on Linux systems. On Windows they might use a different implementation (of hs.SpeakToFile API), but that detail is left to HS3 not to the plugin. Possibly the plugin could call a custo script instead of the HS3 hs.SpeakToFile API, but really have to study in more details and evaluate.

        Comment


        • #5
          Ok thank you PCP

          Comment


          • #6
            pcp Hi,

            did you have the chance to chek this?

            thanks

            Comment


            • #7
              I did look into it bit last year (for both Windows and Unix version), but ran into some issues and then had to put it aside due to other constraints.

              Comment


              • #8
                ok let me know if you have something new ! thanks

                Comment


                • #9
                  What do you have in your speak_to_file.sh ?

                  What audio file format does the SqueezeBox plugin expect?

                  Comment


                  • #10
                    This is what i have in my speak_to_file.sh ( this works with airplayspeak for now) : So a mp3 it made by amazon. And it is tranfered back to .wave for airplaispeak.


                    #!/bin/sh
                    ./PollyC.py -o "$1_t" -t "$2" -c "./pollycache/" -k "xxxxxxxxxxxxxxxxx" -a "xxxxxxxxxxxxxxxxxxxxxxxxx" -v "Joanna"
                    ffmpeg -i "$1_t" -y -ar 44100 "$1"
                    rm "$1_t"


                    here is a speak-to-file.sh that works with lms plugin.

                    There's a .wave made by pico2wave. Then the LMS plugin conver this back to mp3 with the lame package ( see picture)
                    The lms plugin is transfering the files here : \HomeSeer\html\SqueezeBox


                    #!/bin/sh
                    pico2wave -l en-US -w "$1" "$2"
                    Attached Files

                    Comment


                    • #11
                      !!

                      I am now able to play amazon polly TTS with squeezebox.


                      1. I installed the Airplaybridge plugin on the squeezebox side ( shairport was already installed on all 3 raspi). Remove all my squeezelite player from my 3 pis....and try the tts with the ''new'' players. It now works !! I believes Shairport can now handle what is sent as tts.


                      Here are two screen captures of the settings.

                      And my speak_to_file.sh:

                      Code:
                      #!/bin/sh
                      ./PollyC.py -o "$1_t" -t "$2" -c "./pollycache/" -k "xxxxxxxxx" -a "xxxxxxx" -v "Joanna"
                      ffmpeg -i "$1_t" -y -ar 44100 "$1"
                      rm "$1_t"
                      Attached Files

                      Comment


                      • #12
                        But two issues with the plugin.

                        1. if a tts play , the song that was playing restart from the beginning.
                        2. if i set the parameter ''TTS Additional Speech Duration'' to low ( 3000 ms) and I send a long tts, then the tts get cut. And if i set a long one , the tts do not get cut.. but the song take forever to restart...

                        is there a way to do something for those issues?.

                        Setting the song to the beginning is not that nice..
                        And I have to say the user experience is quite reduced, if i have to change the setting ''TTS Additional Speech Duration'' every time there's a tts.

                        Comment


                        • #13
                          update: seems to not be possible to send a tts to all player with this method if the player are syncronised ( they play 2-3 time or does not play + not syncro)... works fine if they are not... I hope there is a setting for this.

                          Comment


                          • #14
                            The only way I found to ''patch'' the very post #13 problem to do like in the picture 1. unless there are some way to manipulate something. I,ll have to enter a event that conditionally call other event ( s) before and after the tts occur to really patch this problem (i.e. Event Before Speaking, Event After Speaking). i'll have to think about every possible action that need to be done before and after a tts occur.
                            Attached Files

                            Comment


                            • #15
                              Originally posted by MattL0 View Post
                              But two issues with the plugin.

                              1. if a tts play , the song that was playing restart from the beginning.
                              2. if i set the parameter ''TTS Additional Speech Duration'' to low ( 3000 ms) and I send a long tts, then the tts get cut. And if i set a long one , the tts do not get cut.. but the song take forever to restart...

                              is there a way to do something for those issues?.

                              Setting the song to the beginning is not that nice..
                              And I have to say the user experience is quite reduced, if i have to change the setting ''TTS Additional Speech Duration'' every time there's a tts.
                              Based on the plugin is trying to determine the length of the song (looking at the mp3 file) and getting notification from the LMS, the plugin is trying to determine when the TTS si done to switch back to the prior track and restore the prior position. Not all music sources in LMS let you go back to the specific position in the track and start playing from there. It would be interesting to see the verbose debug log around the time the TTS is generated (form HS3 to the time it is played).

                              Comment

                              Working...
                              X