BaReinhard / Super-Simple-Raspberry-Pi-Audio-Receiver-Install

Super Easy installation to make your Raspberry Pi an Audio Receiver
GNU Affero General Public License v3.0
490 stars 88 forks source link

Possible Solution for say.sh #41

Closed ibrodowski closed 6 years ago

ibrodowski commented 7 years ago

@BaReinhard

I know that this isn't necessarily an issue, so I apologize in advance.

I noticed that say.sh was all commented out, so I decided to figure out what's going on with it.

My RPi setup:

Ran install.sh using the following options:

After reboot, the following manual changes were made:

List audio-devices using aplay -L, but the known working output devices are as follows:

  1. plughw
  2. sysdefault

Modify say.sh in /usr/local/bin (change sysdefault to plughw as needed): #!/bin/bash say() { local IFS=+; espeak $* --stdout | aplay -D 'sysdefault' } 2>/dev/null say $*

Results - Updated @ 0838 PDT:

BaReinhard commented 7 years ago

This is great, I never got around to getting into it with say.sh. I was only able to have it say something when connected via hdmi and somewhat lost interest. If you are able to implement this into a pull request I will gladly merge it.

ibrodowski commented 7 years ago

I'll work on implementing this potential fix into a PR after I've completed additional testing.

I've got a Raspberry Pi Zero W that I use in the car, which was set-up using the custom option, bluetooth-only, no shairport, so I'd like to make sure it works as expected.

I'll need to figure out a simple way to read the output from aplay -L and search for the keywords of plughw and/or sysdefault and then update say.sh to match either-or accordingly (without having to resort to some crazy kung-fu scripting skills).

I've got another question regarding simple-agent.autotrust, so I'll just submit another issue.

BaReinhard commented 6 years ago

Been MIA lately, but I think ill be more active for at least a couple weeks until a new job starts. The easiest way to get data from aplay would be something like

sysdef=`aplay -l | grep sysdefault`
plughw=`aplay -l | grep plughw`

if [ -z "$sysdef" ]; then
  update say.sh for sysdef
  exit 0
fi
if [ -z "$plughw" ]; then
  update say.sh for plug hw
  exit 0
fi

Or something along those lines, there are likely some syntax errors , but the grep commands should hold water.

BaReinhard commented 6 years ago

closed for inactivity. If a solution is provided, I would gladly add to the install.

Lauszus commented 6 years ago

I got espeak working using the following command in say.sh:

espeak "$*" --stdout | aplay -Dsysdefault

Note that setting the device to -Dplughw:0,0 work as well.

Note the quotes around $* is important. Without that only "Device" would be said, as @ibrodowski also experienced.