Re: Networking and volume control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Perhaps this might help: when you set the PULSE_SERVER env variable, all the commands you run will be run against the Rpi, basically going around the local machine configuration. That's why you're seeing different sink configurations when you do pactl... it's effectively the same as you logging into the pi, and running pactl there.

The second dump shows the pi in as a tunnel sink seen from your PC's PA context, which is what you want.

I don't use pavucontrol, but I don't know of any reason why it can't control a sink that is in actuality a remote/tunnel sink, and the fact that the volumes are listed there in the second dump means I might be right.

Have you tried doing this on your workstation box? 
pactl set-default-sink tunnel.dietpi-music.local.alsa_output.default

And then doing things will by default (but not exclusively) happen on the sink on the pi. But you can still tell other apps to use other sinks. Be careful that this is what you want, of course, because you probably don't want your UI stuff to beep on the Pi. It might be better to just specifically force the things you want (music player?) to the sink you want.

One thing to note is that once you have things pretty well setup, PA does try and restore things as they last were... so if you manually set one app to send to the tunnel, I think PA will try and preserve that as the app and the sink come and go.

You can also write little script shims, if you follow me, that are little 3-4 line scripts to do things like volume and mute and stuff by setting the server and running the command there. I should think that these could be little GUI-aware shims, too, making .desktop files (or the equivalent), so when you run one, it sets up the environment for you and connects to the right sink.

For whatever it's worth, I too am using a rPi on a hifi system that is remote from my work-a-day computer. I don't manage the volumes at all, leaving that to the audio gear, but I have a somewhat complex setup that is in two rooms with sync'd playback across several devices that has been borne of years of trial and error with pactl. I'm using mpd, librespot, shairport-sync, and have a Chromecast hooked up to one box to "stream" from one soundcard as a source to another as a sink. And FWIW, I ignored the advice and ran PA on the Pi in System mode. I don't know that the priority stuff matters for something like usb audio, which shouldn't tax the system very much. Anyway, if you want to ask me more about my setup, feel free here or off-list.

On Fri, Nov 6, 2020 at 10:45 AM Matt Garman <matthew.garman@xxxxxxxxx> wrote:
I posted about this earlier, but now am facing a different problem.
Recap from original post:

I have PulseAudio set up on a Raspberry Pi as a sound server.  The RPi
is connected to a USB DAC, which has hardware volume control
capabilities.  This is what I have in my /etc/pulse/default.pa:

load-module module-alsa-sink control='D70 '

Note: I am deliberately NOT loading module-udev-detect, otherwise
PulseAudio reverts to software volume control.  (The device is a
Topping D70, and the space between the zero and the quote above is
deliberate.)

Now, on the client, if I do this:

# PULSE_SERVER=rpi_server_hostname pavucontrol

Everything works as expected.  That is, I have an output device
("D70") whose hardware volume I can control with pavucontrol.  So I
went ahead and put "default-server = rpi_server_hostname" in my
~/.pulse/client.conf.  Then all my apps route sound to the RPi.

But then I realized that config makes the RPi the *only* sound device
I can use on my PC.  Sometimes I plug in other devices (e.g. webcam,
headphones) directly to the PC, and those get ignored with the
"default-server" config in place.

So it looks like one solution is to remove the "default-server" config
on the client, and use zeroconf/avahi so that the client can
automatically discover the RPi server as another output device, and
co-exist with local devices.

I set this up, basically by loading the "module-zeroconf-discover" on
the client PC, loading "module-zeroconf-publish" on the RPi server,
and running the avahi daemon on the server.  With this in place, I do
see the RPi server showing up as an output device on my PC.  However,
it doesn't work: I can't get any sound to come from it.  Furthermore,
the volume control doesn't have any effect either.  (I can play sounds
via MPD running locally on the RPI server.  I can adjust the volume in
an MPD client.  I can adjust volume from my PC using pavucontrol only
when using PULSE_SERVER or default-server, but not with the zeroconf
config I'm trying to get working.)

My suspicion is the zeroconf is only working enough to advertise the
device as available, but not advertising enough info to actually make
the device usable.

My other thought is that, given how I had to explicitly configure the
control on the server side, maybe I need to do a similar explicit
config on the client side?

I don't know if this helps, but maybe it offers a clue: on the client
PC, running "pactl list sinks" with and without being prefixed by
PULSE_SERVER:

$ PULSE_SERVER=dietpi-music pactl list sinks
Sink #0
        State: RUNNING
        Name: alsa_output.default
        Description: D70
        Driver: module-alsa-sink.c
        Sample Specification: s32le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 5
        Mute: no
        Volume: front-left: 5727 /   9% / -63.51 dB,   front-right:
5727 /   9% / -63.51 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor Source: alsa_output.default.monitor
        Latency: 22567 usec, configured 24988 usec
        Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
        Properties:
                alsa.resolution_bits = "32"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "USB Audio"
                alsa.id = "USB Audio"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "1"
                alsa.card_name = "D70"
                alsa.long_card_name = "Topping D70 at
usb-0000:01:00.0-1.2, high speed"
                alsa.driver_name = "snd_usb_audio"
                device.bus_path =
"platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0"
                sysfs.path =
"/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/sound/card1"
                udev.id = "usb-Topping_D70-00"
                device.bus = "usb"
                device.vendor.id = "152a"
                device.vendor.name = "Thesycon Systemsoftware & Consulting GmbH"
                device.product.id = "8750"
                device.product.name = "D70"
                device.serial = "Topping_D70"
                device.string = "default"
                device.buffering.buffer_size = "705600"
                device.buffering.fragment_size = "352800"
                device.access_mode = "mmap+timer"
                device.description = "D70"
                alsa.mixer_name = "USB Mixer"
                alsa.components = "USB152a:8750"
                device.icon_name = "audio-card-usb"
        Formats:
                pcm


Versus running without the PULSE_SERVER environment:

$ pactl list sinks
Sink #0
        (snipped for brevity - my HDMI monitor, which has sound output
capabilities)

Sink #1
        State: SUSPENDED
        Name: tunnel.dietpi-music.local.alsa_output.default
        Description: D70 on root@dietpi-music
        Driver: module-tunnel.c
        Sample Specification: s32le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 26
        Mute: no
        Volume: front-left: 7575 /  12%,   front-right: 7575 /  12%
                balance 0.00
        Base Volume: 65536 / 100%
        Monitor Source: tunnel.dietpi-music.local.alsa_output.default.monitor
        Latency: 0 usec, configured 0 usec
        Flags: NETWORK HW_MUTE_CTRL HW_VOLUME_CTRL LATENCY
        Properties:
                device.description = "D70 on root@dietpi-music"
                tunnel.remote.server = "[10.18.51.63]:4713"
                tunnel.remote.sink = "alsa_output.default"
                device.icon_name = "computer"
                tunnel.remote_version = "32"
                tunnel.remote.user = "root"
                tunnel.remote.fqdn = "dietpi-music"
                tunnel.remote.description = "D70"
        Formats:
                pcm


Thank you for any help or hints!
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux