Closed reparator closed 11 months ago
Hi,
I've never dealt with Pulseaudio. As far as I know there is no Pulseaudio involved if you have a no-desktop OS like Raspberry Pi OS Lite. What will happen if you specify 'default' device explicitly:
pi@squeezebox5:~ $ aplay -D default ~/Music/Maple\ Leaf\ Rag.wav
Best regards
Hi, thanks for your quick response!
pi@squeezebox5:~ $ aplay -vD default ~/Music/Maple\ Leaf\ Rag.wav
Wiedergabe: WAVE '/home/pi/Music/Maple Leaf Rag.wav' : Signed 16 bit Little Endian, Rate: 44100 Hz, stereo
ALSA <-> PulseAudio PCM I/O Plugin
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 22050
period_size : 5512
period_time : 125000
tstamp_mode : NONE
tstamp_type : GETTIMEOFDAY
period_step : 1
avail_min : 5512
period_event : 0
start_threshold : 22050
stop_threshold : 22050
silence_threshold: 0
silence_size : 0
boundary : 1445068800
Musik plays ok, but no pipe filled!
As far as I know there is no Pulseaudio involved if you have a no-desktop OS like Raspberry Pi OS Lite.
Good point! I use the desktop-os because I need X11 for the Squeezebox-Software. I searched the pulseaudio pages on https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/. There is described how to stop pulseaudio. I will try that and hope that alsa will do the job than. I will come up with a report ... Regards Stefan
Ok, seems to be difficult: The Squeezebox-Software needs X11, X11 is configured to use pulseaudio and I'm too stupid to see through this forest of configuration files in pulseaudio. Pulseaudio seems to speak directly to the sound-cards via this module "module-alsa-sink". Here https://wiki.debianforum.de/MPD_als_Systemdienst_mit_ALSA_und_Pulseaudio is described a similar problem as far as I can see. The .asoundrc is not noticed by Pulseaudio-ALSA-Plu, means although the integration of the meters and peppyalsa-plugin throuh .asoundrc is not conducted. The only solution seems to be a new peppy-pulseaudio-plugin-module .-) Regards Stefan
Sorry, I cannot help you with Pulseaudio. If you will find a solution please let me know.
Best regards
I'll do some more studies. Regards Stefan
OK, I solved it :-) The problem is, that Pulseaudio catches the sound-output-device and uses its own plugin to play the sound. The responsible plugin is the ALSA <-> PulseAudio PCM I/O Plugin. This is a good method in principle as the user (or the sound playing application) has not to care for it. The plugin works flawless and silent with most applications. But: In our case we want to smuggle our own output device (the fifo filling peppy-alsa-plugin) in the stream. As we don´t have a pulseaudio-like plugin with peppyalsa functionality, we need to redirect the pulseaudio-sound-stream to the standard ALSA-plugin module-alsa-sink. Here is a description how I solved it for me: Install peppyalsa-plugin as described (get it, compile it and install it). https://github.com/project-owner/peppyalsa.doc/wiki/Installation Create a file .asoundrc in the users home directory with the content as described here https://github.com/project-owner/peppyalsa.doc/wiki/Configuration Compile the peppyalsa-client:
pi@squeezebox:~ $ cd /home/pi/peppyalsa/src
pi@squeezebox:~/peppyalsa/src $ gcc peppyalsa-client.c -o peppyalsa-client
pi@squeezebox:~/peppyalsa/src $ ./peppyalsa-client
Add a pulseaudio configuration file to the users config files:
pi@squeezebox5:~ $ cd ~/.config/pulse/
pi@squeezebox5:~/.config/pulse $ nano default.pa
with the following content:
# include the standard file
# .include /etc/pulse/default.pa
# unload-module module-udev-detect
# unload-module module-card-restore
# unload-module module-detect
load-module module-alsa-sink device=softvol_and_peppyalsa
load-module module-native-protocol-unix
load-module module-always-sink
# load-module module-suspend-on-idle
The file ~/.config/pulse/default.pa is read at login time if it exists and replaces the standard pa-configuration file which resides in /etc/pulse/. Our file redirects the output of the stream via the module module-alsa-sink to the device softvol_and_peppyalsa which is described in ~/.asoundrc.
To test it, start the peppyalsa-client:
pi@squeezebox5:~ $ ~/peppyalsa/src/peppyalsa-client
Peppy ALSA Client. Goya Edition. 2018/09/08
No pipe name provided, defaulting to /home/pi/myfifo
L:
R:
Now play some music from your favorite X11 player (e.g. vlc - I used my java app softsqueeze). You should see some jitters of the meters. If not, try to increase the volume by:
pi@squeezebox5:~ $ pactl set-sink-volume @DEFAULT_SINK@ +20%
pi@squeezebox5:~ $ pactl set-sink-volume @DEFAULT_SINK@ +20%
pi@squeezebox5:~ $ pactl set-sink-volume @DEFAULT_SINK@ +20%
or 2.
`
pi@squeezebox5:~ $ alsamixer
`
Choose with F6 your output soundcard and increase the pcm-channel (e.g. to 80 %)
or 3.
Change the value for meter_max in ~/.asoundrc:
In the device "pcm_scope.peppyalsa" write
`meter_max 1000`
I hope this helps somebody. It took me some days to look through the audio forest. Even if the documentations of alsa and pulseaudio are really comprehensive it is not easy to understand for a simple user.
Regards
Stefan
Thanks to peppyowner for his efforts and continuous enhancement of the fantastic peppyplayer project!
Great job! Hopefully it will be helpful for somebody else. Thank you!
Good evening, I have a question regarding peppyalsa-plugin. Hopefully you can help. Sorry for the long text, I wanted to provide as much information as possible in the first step. I am on my way to build my own squeezebox on a RPi 3+. The linux I use is:
pi@squeezebox5:~ $ cat /proc/version Linux version 5.10.103-v7+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1529 SMP Tue Mar 8 12:21:37 GMT 2022
Unfortunately it is using Pulseaudio for playback music by default. As Soundcard I have:
Playback works with cvlc, aplay and the java application SoftSqueeze. Sound comes in good quality from the speakers.
Now I want to adapt the peppyalsa plugin because I want use my DIY Nixxie-style arduino based VU-Meter. So I setup peppyalsa-plugin and configured it. It works, but only if I playback with aplay with explicite given device:
The fifo-pipe is filled and peppyalsa-client shows VU signals.
When I play with default device, playback works (sound comes out of the speakers) but the fifo pipe stays empty. Either it is not rebuild if I delete it before playing.
I think the problem is that the sound goes directly from Pulseaudio to the ALSA <-> PulseAudio PCM I/O Plugin without using the inputs given in ~/.asoundrc. The same happens when I playback with cvlc or Softsqueeze. ~/.asoundrc looks like this:
Is there a chance to switch of the pulseaudio-alsa-plugin or redirect it to use the .asoundrc-config-file? Or simply said: How can I use peppyalsa-plugin with Pulseaudio? If I understand it right, ALSA is the base which communicates with the hardware (soundcard) whereas PA resides on top of Alsa as a higher level layer. Your help would be appreciated! Regards Stefan