Difference between revisions of "PulseAudio and Stream Extension"

From SOUND4wiki
(Created page with "= The problem = SOUND4 provides ALSA driver for the cards. The SOUND4 Stream extension uses the ALSA driver recording directly, not shareable, and runs as service at system s...")
 
m
 
Line 1: Line 1:
= The problem =
+
=The problem=
 
SOUND4 provides ALSA driver for the cards.
 
SOUND4 provides ALSA driver for the cards.
  
Line 12: Line 12:
 
The SOUND4 Stream can not use Pulse Audio, otherwise it won't work unless user is logged in, and this would delay the start of streaming.
 
The SOUND4 Stream can not use Pulse Audio, otherwise it won't work unless user is logged in, and this would delay the start of streaming.
  
= Fixing by manually configuring PulseAudio =
+
=Fixing by manually configuring PulseAudio=
 
One way may be to force to load the specific card devices in Pulse Audio.
 
One way may be to force to load the specific card devices in Pulse Audio.
  
Line 33: Line 33:
 
load-module module-alsa-sink device=hw:SOUND4,0
 
load-module module-alsa-sink device=hw:SOUND4,0
 
</syntaxhighlight>(the hw:SOUND4,0 is the ALSA device name you make from the result of the aplay -l command)
 
</syntaxhighlight>(the hw:SOUND4,0 is the ALSA device name you make from the result of the aplay -l command)
 
 
If the card has multiple outputs, you will see that all will have same name under Pulse (using <code>pavucontrol</code> is useful). So, for a x2 you can for instance use:<syntaxhighlight lang="text">
 
If the card has multiple outputs, you will see that all will have same name under Pulse (using <code>pavucontrol</code> is useful). So, for a x2 you can for instance use:<syntaxhighlight lang="text">
 
load-module module-alsa-sink device=hw:SOUND4,0 sink_name=Channel1
 
load-module module-alsa-sink device=hw:SOUND4,0 sink_name=Channel1
Line 41: Line 40:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Fixing by removing PulseAudio ==
+
==Fixing by removing PulseAudio==
 
You can remove Pulse Audio and use only ALSA.
 
You can remove Pulse Audio and use only ALSA.
  
== Fixing by using ALSA to play music ==
+
==Fixing by using ALSA to play music==
 
You can use any player which supports ALSA audio output instead of PulseAudio.
 
You can use any player which supports ALSA audio output instead of PulseAudio.
 +
[[Category:Streaming]]
 +
[[Category:Troubleshoot]]

Latest revision as of 11:00, 14 February 2024

The problem

SOUND4 provides ALSA driver for the cards.

The SOUND4 Stream extension uses the ALSA driver recording directly, not shareable, and runs as service at system startup.

The PulseAudio system, bundled with Ubuntu and some other distros, is a per-user software, starting with X server.

The Pulse Audio daemon (at least in latest versions) checks that all sub-stream of an ALSA card are unused or it does not use the card at all.

So, the card will not appear at all in Pulse devices (was not the case in old Ubuntu).

The SOUND4 Stream can not use Pulse Audio, otherwise it won't work unless user is logged in, and this would delay the start of streaming.

Fixing by manually configuring PulseAudio

One way may be to force to load the specific card devices in Pulse Audio.

For this, you need to identify your card in ALSA:

aplay -l

For a single card, the card should be named SOUND4.

card 0: SOUND4 [S/N 13091005], device 0: Channel_1 [Process 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Depending on the process, there might be multiple subdevices. For a second card with multiple channels:

card 1: SOUND4CARD2 [S/N 13091005], device 0: Channel_1 [1- Ch1 (S/n 13091005)]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: SOUND4CARD2 [S/N 13091005], device 1: Channel_2 [2- Ch2 (S/n 13091005)]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

As an administrator, edit /etc/pulse/default.pa and add to the end:

load-module module-alsa-sink device=hw:SOUND4,0

(the hw:SOUND4,0 is the ALSA device name you make from the result of the aplay -l command) If the card has multiple outputs, you will see that all will have same name under Pulse (using pavucontrol is useful). So, for a x2 you can for instance use:

load-module module-alsa-sink device=hw:SOUND4,0 sink_name=Channel1
update-sink-proplist Channel1 device.description=Channel1
load-module module-alsa-sink device=hw:SOUND4,1 sink_name=Channel2
update-sink-proplist Channel2 device.description=Channel2

Fixing by removing PulseAudio

You can remove Pulse Audio and use only ALSA.

Fixing by using ALSA to play music

You can use any player which supports ALSA audio output instead of PulseAudio.