Closed dgonano closed 7 years ago
It's surprisingly tricky, but have a look at #437 and its references...
Upon review of the man I see it's possible to use -D & -R to imitate a mute.
when it runs on boot it doesn't run in daemon mode though so these don't work, is there a way to change this? like always write the PID to file or change how it starts via service?
@mikebrady okay, i'll have a look
Okay that looks pretty complicated. Is the DACP stuff actually in the metadata now?
That's not really what I want to do anyway as that's controlling the source. I just want to control the program locally. e.g., shairport-sync --volume 50
which would get the PID and reduce the volume to 50% of current. 100
to put it back to previous volume, 0
for mute, etc. It's just an output adjustment rather than source control.
I notice there is an option to ignore source volume or run it at 100%. I think this would be the correct area to introduce something like this.
The -D
and -R
options are deprecated, and the daemon mode stuff is out of date with recent Linux distributions, so those solutions don't have much of a future.
Enough information is in the metadata to enable a separate program to locate the audio sender and send commands back to it – that's the approach that's been taken by other developers, as you've seen.
The real issue with your idea is that there is no satisfactory way to communicate with Shairport Sync; it needs something like a d-bus
interface. That will take some time...
Forgive my linux knowledge but why are they deprecated and don't have any future?
Thats great, but is completely impractical for what I need.
What can't we communicate with the process like the -D and -R options so? Even just being able to use those two would be something.
Why don't configure ALSA properly so that shairport uses its own volume control?
@joerg-krause I'd love to do that, then I could just use the also commands to mute & change volume. Problem is I'm no ALSA expert so i might need some guidance.
Here is the output of some of the simple commands I know. I have a usb microphone and the built in speakers that go to a 3.5mm and HDMI (i think)
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
dmix:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample mixing device
dmix:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample snooping device
hw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Hardware device with all software conversions
pi@raspberrypi:~ $ amixer scontrols
Simple mixer control 'PCM',0
How would I go about configuring it properly so that I can control the output of this and AlexaPi separately? If i need to change it I know where to change the output_device: "default"
part in AlexaPi.
I am not an expert, too. But I am using the softvol plugin.
@joerg-krause Yeah i saw something like that. So you set the slave as the default device and then you can control the volume of data going to softvol independently ;)
How do you get shairport-sync to send it's audio to softvol?
Please have a look at https://github.com/mikebrady/shairport-sync/issues/290.
@joerg-krause Thanks, I figured it out in the end, i think it I can get it to do exactly what I want. Thanks for you help!
Hi,
I'm running (and I'm sure others are also) shairport-sync on a system which also runs other stuff.
Maybe it's already possible but I was wondering how the system could control shairport-sync for the following actions:
This would be good because other systems (like a speech recognition service e.g., @alexa-pi) use the microphone/speaker too and it would be nice to mute or lower the volume on shairport while it listens/speaks. Obviously it would un-mute or revert the volume to normal when its done.
Is there a way to do this or would it be possible to implement? I'd be happy to work on it but i'd need a pointer on where to look.