Announcement

Collapse
No announcement yet.

Making Sound Work on HS3 Linux

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

  • Making Sound Work on HS3 Linux

    Wanted to share how I finally got speaking events to work on Homeseer linux.

    First I should point out that I made the directory naming issues easier by using symbolic links between all lower case names and the mixed case used in the install. I find it much easier as I don't have to worry so much about case and all files are stored in a single directory. As an example, I had image & Image directories so combined into single and symbolic link takes care of the other command is sudo ln -s /opt/homeseer/html/Image /opt/homeseer/html/image

    My system is run on a dedicated supermicro server running Ubuntu 18.04 server. I purchased used. All details are given below. I built an HSTouch system with designer and have 4 dedicated HSTOUCH tablets. They are inexpensive insignia tablets of multiple generations and have worked well for approximately 6 years.

    Current Date/Time: 6/4/2019 11:56:19 AM
    HomeSeer Version: HS3 Pro Edition 3.0.0.531
    Linux version: Linux HomeSeer-Server 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux System Uptime: 31 Days 21 Hours 4 Minutes 3 Seconds
    IP Address: 192.168.XXX.XXX
    Number of Devices: 507
    Number of Events: 119
    Available Threads: 799
    HSTouch Enabled: True
    Event Threads: 19
    Event Trigger Eval Queue: 0
    Event Trigger Priority Eval Queue: 0
    Device Exec Queue: 0
    HSTouch Event Queue: 0
    Email Send Queue: 0

    Enabled Plug-Ins
    2.0.65.0: BLDSC
    2.0.6.0: BLGarbage
    2.0.43.0: BLLAN
    3.0.25.0: BLLock
    3.0.0.65: EasyTrigger
    5.0.0.59: Global Cache Pro
    3.0.0.14: NetCAM
    3.2.0.1: SqueezeBox
    3.0.1.11: weatherXML
    3.0.1.252: Z-Wave

    I installed some additional programs on the server

    sudo apt install mc (midnight commander - makes ssh CLI work easier)
    sudo apt install flite
    sudo apt install pico2wave
    sudo apt install emacs - editor

    I installed and created a samba share to easily move files to the quasi-headless server.

    pico2wave will take a string and save the spoken output to a .wav file. I could not figure out how to get pico to read from a file
    flite takes a string or text file and save the spoken output to a .wav file.

    The strategy I used to speak the weather was

    write script to accept Device Reference ID as sole input, get the device string, then write the device string to a text file to be read by flite.
    I used a base script from the forum as a template. Part of the reason I am sharing is it took a while to figure all this out.

    here is my .vb script which I named WriteTxtFile.vb


    ------------------------ Script --------------------------------------------------
    IMPORTS System.IO
    IMPORTS System.net

    Sub Main(ByVal parm As Object)

    Dim objReader As System.IO.StreamWriter
    Dim FQPN As String = "/opt/homeseer/media/Text.txt" '<---- use homeseer not HomeSeer because I have the symbolic links
    Dim DvRef As Integer = parm '<----- pass Reference ID as parm make it an integer
    Dim Txt As String = hs.DeviceString(DvRef) '<----- Get the device data

    Try
    objReader = New System.IO.StreamWriter(FQPN)
    objReader.Write(Txt)
    objReader.Close()
    Catch Ex As Exception

    hs.writelog("Script", Ex.Message)

    End Try
    End Sub
    -------------------------------------------- Script ------------------------------------

    I used this website to create mp3 files.

    https://soundoftext.com/

    This creates .mp3 files which can be converted to .wav files using sound converter on Linux. My desktop is linux mint 19.03 the wave files go in /opt/homeseer/media (symbolic links) I find this is much faster and voice is more responsive than doing the conversion real time. This site also has a very nice voice.

    The event I created was to greet my wife in the morning and inform her of the weather for the day triggered by motion sensor.

    Click image for larger version

Name:	script.png
Views:	59
Size:	138.2 KB
ID:	1308792
    I use the counter to have it only speak once.

    What I like about the script is now I can reuse for other events.

    The voices available for flite are: kal | awb_time | kal16 | awb | rms | slt


    Hope this saves someone time and frustration. This is not the only way and it may not be the best but it works reliably.
    Attached Files

  • #2
    How is the quality of the tts?

    Comment


    • #3
      With the files from the website -it is very good. With Flite it depends on the voice. I think SLT is the best. I uploaded a zipped mp3 file so you can listen and decide for yourself.
      Attached Files

      Comment


      • #4
        That's not too bad. I've tried flite a couple of years ago and I didn't want to use it because of the quality.
        Will try it again.
        Thank you for sharing.

        Comment

        Working...
        X