Announcement

Collapse
No announcement yet.

HS3 Linux Ubuntu not speaking for me anymore.

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

  • HS3 Linux Ubuntu not speaking for me anymore.

    Wondering if anyone has some advice for me. I'm running Linux HS3 (3.0.0.500) on Ubuntu 18.04.2. I've been using VoiceRSS web service for speech (it's the last script referenced in this thread https://forums.homeseer.com/forum/ho...linux?t=175012). It's been working great. But now, I can't get anything.

    The script replaces the contents of the "Speak_to_file.sh". The magic line of the script is this.

    mpg123 -w $1 -q "http://api.voicerss.org/?key=myapikey&f=48khz_8bit_stereo&hl=en-gb&src=$NEXTURL"

    and something like this always shows up in the HS3 log
    Feb-28 6:16:01 PM Warning Wave file not found when speaking, file: /usr/local/HomeSeer/wave_files/8speak_temphst.wav
    Feb-28 6:16:01 PM Warning Wave file not found when speaking, file: /usr/local/HomeSeer/wave_files/7speak_temphst.wav
    Feb-28 6:16:00 PM Warning Wave file not found when speaking, file: /usr/local/HomeSeer/wave_files/6speak_temphst.wav
    Feb-28 6:16:00 PM TTS Speak: ():Hello, I am dog. I am hungry. please feed me.
    Feb-28 6:16:00 PM Device Control Device: 1: Kitchen Virtual Feed Hershel Status to Feed Hershel! (100)
    Feb-28 6:16:00 PM Event Event Trigger "Recurring Feed Hershel PM"
    Manually issuing the web service call correctly generates the wav file. So, I know VoiceRSS is still good. (ie http://api.voicerss.org/?key=Your_API_Key&f=48khz_8bit_stereo&hl=en-gb&src="Hello, I am dog. I am hungry. please feed me."

    mpg123 seems to work fine at the command line (ie no errors), but still no output.

    I put speak_to_file.sh back to the original. It uses flite. And that works fine. So, it would seem it's an issue with mpg123. I did the obvious "apt remove mpg123", and then "apt install mpg123". No luck


    I'm not sure what to do next. Any ideas?



    David Lover
    HomeSeer 3.0.0.500
    Linux Ubuntu 18.04.2

  • #2
    Add this line near the beginning of your speak_to_file.sh - right after the banner would be a good place.

    Code:
    exec > /tmp/speak_to_file.log 2>&1
    Then all the text output of the script, including error messages, will be written to file /tmp/speak_to_file.log

    Comment


    • #3
      Originally posted by zwolfpack View Post
      Add this line near the beginning of your speak_to_file.sh - right after the banner would be a good place.

      Code:
      exec > /tmp/speak_to_file.log 2>&1
      Then all the text output of the script, including error messages, will be written to file /tmp/speak_to_file.log

      Copied and stored! This little tidbit of how to have a script create a log just might come in handy down the road.
      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


      • #4
        Wow that is a cool little tip! Thank you! It worked like a charm. Sadly, not sure what to do with the output. I'll need to check the format of the file that I get back from VoiceRSS. If it's an MPEG1/2, then must just be a bug with mpg123.

        ---------------------------
        Speech Script by Dan Fountain
        TalkToDanF@gmail.com
        ---------------------------
        Playing line: 1 of 1
        main: [src/mpg123.c:679] error: Unknown mpeg MIME type audio/wav - is it perhaps a playlist (use -@)?
        main: [src/mpg123.c:680] error: If you know the stream is mpeg1/2 audio, then please report this as mpg123 bug

        Comment


        • #5
          audio/wav - sounds like it may already be in WAV format? In which case you wouldn't need mpg123 at all. mpg123 is used here to convert from MPG to WAV.

          Comment


          • #6
            Hmmm. So, for fun, I changed the web service call, adding c=mp3. This changes the codec from the default WAV to MP3 (http://www.voicerss.org/api/documentation.aspx)


            giving me this.

            mpg123 -w $1 -q "http://api.voicerss.org/?key=myapikey&f=48khz_8bit_stereo&hl=en-gb&c=mp3&src=$NEXTURL"

            And it works! So, either the format of mpg123 changed or the defaults of the voicerss changed?

            So, zwolfpack, you said if voicerss is already providing a wav file, you wouldn't even need mpg123. How would that work? I'm assuming that mpg123 is somehow putting the resulting wav file into the wave_files directory and something is playing out some kind of virtual sound card that sends it to the right registered HST client speakers? What would that script need to look like then, if I don't need to use mpg123?

            Comment


            • #7
              Try something like this

              Code:
              #!/bin/sh
              # speak_to_file.sh
              
              # commandline inputs
              outfile="$1"
              shift
              text="$@"
              
              # this script name
              myname=$(basename $0 .sh)
              
              # uncomment next line to enable debug log
              #exec > /tmp/$myname.log 2>&1
              
              # voicerss parameters
              key=Your_API_Key
              f=48khz_8bit_stereo
              hl=en-gb
              
              # encode text to be spoken
              src=$(echo "$text" | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g')
              
              # construct URL
              url="http://api.voicerss.org/?key=$key&f=$f&hl=$hl&src=$src"
              echo $url
              
              # fetch URL to outfile
              wget -q "$url" -O "$outfile"
              There is an issue with the original script, unrelated to what you've been fighting. The script works as expected for short phrases, but once a phrase exceeds a little over 100 characters, it gets broken up into multiple segments, with a web request for each. Problem is, the output file is the same for each, so only last segment of the phrase gets spoken.

              Comment


              • #8
                zwolfpack, you are a god among mortals. Works like a dream. And so much easier to follow along (mostly). I'll research the pieces I don't quite get. Thank you so much!!!

                Comment


                • #9
                  Great, glad it worked out for you. I wanted to test it myself, but was too lazy to register!

                  Comment

                  Working...
                  X