Announcement

Collapse
No announcement yet.

Caching Speech routines using Amazon Polly

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

    #31
    Something I noticed, Amazon Polly free tier expires after 12 months After that its $4/month: https://aws.amazon.com/polly/pricing/.

    Comment


      #32
      So I missreaded that the first time. This is not a price based on sompsumtion . There is a starting price of 4$

      Comment


        #33
        Mmm ok we’ll see next year if It is profitable to continu the service. But for the time being this is n awesome option.

        Comment


          #34
          I believe there is a free amount if under some given number of accesses. That's where PollyC comes into play. You won't see new quires unless you're using text that changes. My system speeks time on the hour and half hour along with all of the other messages. It hasn't contacted the Polly servers for months.
          HomeSeer Version: HS3 Standard Edition 3.0.0.548
          Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
          Number of Devices: 484 | Number of Events: 776

          Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
          3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
          4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
          3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

          Z-Net version: 1.0.23 for Inclusion Nodes
          SmartStick+: 6.04 (ZDK 6.81.3) on Server

          Comment


            #35
            Per the link I posted, its free for the first year (for all practical purposes we aren't going to exceed 5 million characters per month). After that you pay $4.00 per 1 million characters.

            At first reading, I thought it was $4/month for 0-1M characters, but upon re-read, appears they bill just by what you use. In that case it would only be pennies.

            Comment


              #36
              Let me tell you what I'd like to see Homeseer do. Rewrite the Speak routines so they can be pass more parameters. This would also need to make an update to HS3 so it could pass the additional parameters but if done correctly it would be backward compatible with the older version by making the additional parameters follow the current ones. Then adjust the existing calling sequence in HS3 to allow the additional parameters to be passed. Most of the time they would be "Null".

              The additional parameters would then be used for things like "Voice to Use" which would allow telling the TTS routine which voice to use.

              Make all TTS speech modules use the same total interface. This would include the existing speaker client making TTS truly open.

              Next, I've offered Homeseer to make PollyC the new default. Now the fact that it's written in Python might be an issue so they could rewrite it. If they do my suggestion would be to modify it in a way that it would go through MyHS, with it's own cache, to get to Amazon's Polly. This way no one has to open an Amazon Polly account. With all of the cacheing there should be very little Polly traffic except when a new account is established. BTW, their should be an option to clear the cache both the local one and the accounts MyHS account cache.

              With speech being locally cached even if the Internet was down speech would not likely be affected.

              HS should not remove any of the existing abilities. The fact that you can use inline setting so adjust the speech is a great feature of PollyC.
              HomeSeer Version: HS3 Standard Edition 3.0.0.548
              Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
              Number of Devices: 484 | Number of Events: 776

              Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
              3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
              4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
              3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

              Z-Net version: 1.0.23 for Inclusion Nodes
              SmartStick+: 6.04 (ZDK 6.81.3) on Server

              Comment


                #37
                Here is an installer for the PollyC package on a Raspberry Pi. It installs everything required to run PollyC.

                - boto3, the Amazon Web Services (AWS) SDK for Python;
                - the mpg123 MP3 player;
                - (r1) ffmpeg/avtools MP3 packages, if available
                - flite (festival-lite) and pico2wave text-to-speech packages; used as a fallback in case of failure of Polly;
                - the HS3 TTS support scripts (speak.sh and speak_to_file.sh) are replaced with Polly capable versions;
                - PollyC.py and PollyC.py3 python scripts are copied into the HS3 root directory;
                - a file PollyC.keys is created in the HS3 root. This contains configurable parameters required by the python scripts.

                To install:
                Code:
                sudo make install-pollyc keyid=your_keyid accesskey=your_secret_code [ region=your-region-x ] [ voice=Voice ]
                Polly usage requires an access code provided by AWS. Check out https://aws.amazon.com/polly/getting-started/. Create an account (free for first year) and generate access credentials. Enter these credentials on the installer command line as shown above, or enter them into the 01settings file in the installer package.

                3/8/2019 revision 'r1'
                - new capability: prepending text with <voice-id="voice"> selects voice for the message.
                - new capability: prepending text with <no-cache> prevents that message from being cached. Useful for dynamic messages not likely to be reused.
                - additional MPEG packages (ffmpeg and/or avtools) are installed if available. For Chromecast support.
                Note that all metatags besides those detailed above are passed to Polly. For example, try this:

                Code:
                <voice-id="Nicole"><speak>Mary had <break time="300ms"/>a little <mark name="animal"/>lamb</speak>
                Attached Files

                Comment


                  #38
                  Originally posted by Timon View Post
                  • Rewrite the Speak routines so they can be pass more parameters
                  • Make an update to HS3 so it could pass the additional parameters
                    • If done correctly it would be backward compatible with the older version by making the additional parameters follow the current ones
                  • Adjust the existing calling sequence in HS3 to allow the additional parameters to be passed
                    • Most of the time they would be "Null"
                    • Used for things like "Voice to Use" which would allow telling the TTS routine which voice to use
                  • Make all TTS speech modules use the same total interface
                    • This would include the existing speaker client making TTS truly open
                  • ...
                  • With speech being locally cached even if the Internet was down speech would not likely be affected
                  • HS should not remove any of the existing abilities
                  Not to mention making the TTS functionality the same on Windows as it is on Linux/Pi!

                  Comment


                    #39
                    I was thinking that it may not even be necessary to do any caching on MyHS. The only reason I suggested it would be if several people used the same text. Even if they do it's a very small amount of data and it only happens once per account unless the local cache is cleared which you'd only do if it looked to be corrupted.
                    HomeSeer Version: HS3 Standard Edition 3.0.0.548
                    Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
                    Number of Devices: 484 | Number of Events: 776

                    Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
                    3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
                    4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
                    3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

                    Z-Net version: 1.0.23 for Inclusion Nodes
                    SmartStick+: 6.04 (ZDK 6.81.3) on Server

                    Comment


                      #40
                      Thanks for this ! Maybe you can put it on github, so we can easily collaborate on it ?

                      Comment


                        #41
                        Timon zwolfpack

                        Guys this looks great and I think is exactly the last piece I need to enable me to move to HomeSeer. I'm currently running a trial of HS3 pro on RPi but I'm planning to buy SEL pro. I have to have TTS to Sonos that sounds good. Reading through this thread it looks like this will solve my problem.

                        I've run the install Script, but I must be missing something to get this to work. I have an event with a speak action that had worked on my Sonos but with that horrible sounding guy. Now I get no sound.

                        Do I need to change anything on the Pi or in the event?

                        The only issue I saw during install was telling to run "auto remove". Should I do that, sound scary?




                        HS3 SEL running Pro Edition 3.0.0.531 on Ubuntu 18.04, mono 5.20, 656 devices, 209 events.
                        Plug-Ins: Chromecast, Device History, EasyTrigger, Ecobee, JowiHue, LutronCaseta, MeiUnifi, PHLocation2, Pushover 3P, SDJ-Health, Sonos, WeatherFlow, weatherXML
                        Scripts: SparkMan's Lock Event, 5 of Jon00 scripts.

                        Comment


                          #42
                          Originally posted by kriz83 View Post
                          Thanks for this ! Maybe you can put it on github, so we can easily collaborate on it ?
                          Let me check into this as I've never put anything on github.
                          HomeSeer Version: HS3 Standard Edition 3.0.0.548
                          Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
                          Number of Devices: 484 | Number of Events: 776

                          Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
                          3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
                          4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
                          3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

                          Z-Net version: 1.0.23 for Inclusion Nodes
                          SmartStick+: 6.04 (ZDK 6.81.3) on Server

                          Comment


                            #43
                            Originally posted by drparker151 View Post
                            Timon zwolfpack

                            Guys this looks great and I think is exactly the last piece I need to enable me to move to HomeSeer. I'm currently running a trial of HS3 pro on RPi but I'm planning to buy SEL pro. I have to have TTS to Sonos that sounds good. Reading through this thread it looks like this will solve my problem.

                            I've run the install Script, but I must be missing something to get this to work. I have an event with a speak action that had worked on my Sonos but with that horrible sounding guy. Now I get no sound.

                            Do I need to change anything on the Pi or in the event?

                            The only issue I saw during install was telling to run "auto remove". Should I do that, sound scary?
                            To enable TTS debug, execute this command

                            touch /tmp/tts.debug

                            Then run the event that should produce speech. A transcript will appear in file /tmp/speak_to_file.log or /tmp/speak.log. For Sonos it will be the former.

                            No need to run auto-remove, that is just a standard message from the Raspbian package system.

                            Comment


                              #44
                              Thanks, had an error in one of my keys!
                              HS3 SEL running Pro Edition 3.0.0.531 on Ubuntu 18.04, mono 5.20, 656 devices, 209 events.
                              Plug-Ins: Chromecast, Device History, EasyTrigger, Ecobee, JowiHue, LutronCaseta, MeiUnifi, PHLocation2, Pushover 3P, SDJ-Health, Sonos, WeatherFlow, weatherXML
                              Scripts: SparkMan's Lock Event, 5 of Jon00 scripts.

                              Comment


                                #45
                                zwolfpack, when I run your installer I keep getting the below error. Any ideas? Thank you in advance.

                                Code:
                                Creating key file...
                                chmod 600 /usr/local/HomeSeer/PollyC.keys
                                chmod: cannot access '/usr/local/HomeSeer/PollyC.keys': No such file or directory

                                Comment

                                Working...
                                X