Announcement

Collapse
No announcement yet.

USB Speaker on Zee-S2 and aplay

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

    USB Speaker on Zee-S2 and aplay

    Hey Folks, I have a USB speaker connected to my Zee-S2. When I login as "homeseer" on the Zee terminal and run "aplay /usr/local/HomeSeer/Media/chime.wav", I hear the audio file just fine and it sounds great. But if I create an HS3 event that launches the action "Plan an audio file" and I set it to play /usr/local/HomeSeer/Media/chime.wav", I don't hear anything. I even modified the event to run "/usr/local/bin/aplay /usr/local/HomeSeer/Media/chime.wav" and still nothing can be heard. No errors show up in the log file when launching the event.

    When I go into Linux Tools and try running aplay from the "Execute a Linux command", I still hear nothing. If I do a "whoami" from the "Execute a Linux command" box, I see "root". Is there a problem with "root" running aplay versus "homeseer" running aplay? What else could be going on here? I also tried all of the above using the "play_audio.sh" script in the /usr/local/HomeSeer/ directory and got the same results. Thanks in advance!

    Current Date/Time: 9/30/2019 10:03:31 PM
    HomeSeer Version: HS3 ZEE S2 Edition 3.0.0.548
    Linux version: Linux HomeTrollerZeeS2V6 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux System Uptime: 0 Days 1 Hour 10 Minutes 51 Seconds
    IP Address: 192.168.1.67
    Number of Devices: 4
    Number of Events: 1
    Available Threads: 399
    HSTouch Enabled: False
    Event Threads: 2
    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

    3.0.1.252: Z-Wave

    #2
    Looks like the file name is chimes.wav, not chime.wav

    Also, aplay is at /usr/bin/aplay, not /usr/local/bin/aplay.

    If you use Linux Tools much, you might want to make an improvement that provide better diagnostics for things like this. Linux commands output text in two streams, named "stdout" and "errout". Generally stdout contains what you want to see when things go right, and errout contains error messages when things go wrong. The HS implementation only captures and displays stdout, so when things go wrong, the error messages get sent to the bitbucket.

    To get errout as well as stdout sent to the screen, modify /usr/local/HomeSeer/run_command.sh as follows:

    Code:
    #!/bin/bash
    # run_command.sh - HS3-linux tools script
    # supports: TOOLS->System->Linux Tools
    
    # 'prompt' displayed is "#" if running as root; "$" otherwise
    test $(id -u) -eq 0 && p='#' || p='$'
    echo "running command: <pre>$p $@</pre>"
    bash -c "$@" 2>&1 | aha

    Comment


      #3
      Yes, I typed in the paths wrong in my post, but I used the correct paths in the HS event.
      With the correct path to aplay and the media file, I still hear no audio when I launch an event that triggers aplay to run.
      Running aplay from the Linux console works great, I'm thinking it has something to do with running aplay as "root" (how HS3 runs it) versus running as user "homeseer", which is how I do it from the console. If I do a "sudo aplay ..." I don't hear any audio, which is very odd.

      Thanks for your suggestion on the modified "run_command.sh" script, I'll see if anything gets reported from stderr.
      I doubt there will be any reported errors, though, since if I run aplay from the HS Linux Tools window then toggle my monitor over to the Linux console, I don't see anything suspicious; in fact, I see the same displayed text as if I had run aplay from the Linux console.

      Comment


        #4
        I was able to get audio through USB speakers working with the following steps:

        1) Connect monitor to the HDMI port of the Zee-S2
        2) Log in as "homeseer", using the password you changed to when you first ran HS3
        3) sudo startx, should bring up an x-terminal session
        4) Apps menu / Preferences / Audio Device Settings
        5) For "Sound card:", select "USB Speaker"
        6) Under "Set Controls", select "PCM" checkbox
        7) Adjust volume to mid-way
        8) Click on "Make Default" button
        9) Open an LXTerminal
        10) cd /usr/local/HomeSeer/Media
        11) run "aplay chimes.wav" and you should hear audio. Adjust volume as desired.

        I'm sure this can all be accomplished with command-line arguments, maybe through amixer?
        Anyway, my events now play audio through USB speakers since audio through the 3.5mm jack sounded horrible.
        If you know how to do this with a single command, please post.

        Comment

        Working...
        X