OpenWrt Forum Archive

Topic: PulseAudio?

The content of this topic has been archived between 14 Mar 2016 and 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

try asking on the pulseaudio mailing-list or on irc (#pulseaudio)

WTF is PulseAudio?

1. What a "soundcard" ultimately does, i.e. has to do, is to transform digital signals coming from inside the calculator into some analog signal and output this analog signal through some port. You can connect some simple loudspeakers to that port, and voila, SOUND.

2. The soundcard hardware is connected to the calculator via PCI/PCIe/USB/etc and needs some hardware drivers, to be able to be spoke to, by the system (kernel).

3. WTF are now ALSA, OSS and PulseAudio?

Alsa is the whole shebang to control your soundcard. It has kernel components as well as the userspace counterparts. Alternatives to Alsa are OSS, Jack, etc.
Pulseaudio lays on top of Alsa to enable more features, for example to wrap around non-Alsa applications, provide better multi-session handling, bluetooth (A2DP) integration with the bluetooth stack Bluez and the ability to stream over the network (including multicast etc.). The latter is what I think is the most interesting feature for OpenWRT.

(Last edited by gertvdijk on 13 Jun 2011, 18:41)

I dont quite get the advantage.

I have sounddata (=some mp3-file) on a harddisk on PC1. When I want to get this data to PC2, I can stream the mp3 itself, which is digital, or I could stream, the analog-data, which would come out of the 3,5mm audio-jack. Of course, I would have to transform this analog signal to some digital signal again, to transport it over Ethernet/WiFi.

In first case I'd use nfs/samba and would need a soundcard on PC2. In the latter case, I would need a server on PC1 and a client on PC2. PC2 would not have to have a soundcard to do the dig2ana, but it would still have to have some 3,5mm jack to connect some loudspeakers to it.

So, I don't understand, why one use something else then nfs/samba/ftp  to stream data.


Localy, it probably give's you the possibility to mess with the digital stream before it get's transformed to analog, and allow you to do, what "Audacity" does, only in real time. You'd want this in case, your soundcard or it's drivers do not support such functionality.

But I don't get "streaming".

(Last edited by scruffy on 13 Jun 2011, 15:17)

Come on. Pulseaudio exists for a reason. If you don't get it, just read the features.

Anyway, in short...
Because you'll have to decode everything on the box with the soundcard. And how about live streaming? How would you stream the output of the sound from that other than running another media player on the box with the sound card? Then there's multicast to output it to several other boxes simultaneously, resampling features, etc., etc.

For what I want to achieve here is to get *all* sound output from my laptop transmitted wireless to my receiver (using my TP-Link box with USB sound card), in realtime.

(Last edited by gertvdijk on 13 Jun 2011, 15:21)

I appreciate you tryin', but my answer remains unanswered ;-)

What exactly does it (PulseAudio) stream, when it streams? mp3? it has to be digital and it should be compressed. The difference to nfs is simple the transport/transfer protocol. ?


Edit: from what I understood, the advantage of PA over NFS is not really huge. You still need 2x Audio hardware+ drivers, and also, you have about the same amount of traffic.

Some  differences are:
  * you can use multicast with PA, you cannot with NFS
  * you can manage the playlist on the server, you cannot with NFS
  * in case you use OpenWrt-Box as client, and not as server, you probably have much more "computing power" for effects. Of course, not the other way around.


Edit2: this simply means, PA is not 20 times better then NFS, it is simply different.

Some people were so excited about PA, that I got the impression this is now //THE// solution for everything sound based.  ;-)

(Last edited by scruffy on 13 Jun 2011, 15:36)

According to this:  http://wiki.ubuntuusers.de/Soundsystem#Routing

The server, does not need sound hardware. It does need a player with a, e.g. mp3-decoder, this data goes to PA, and then this immediately is streamed over the network. But this means, it doesn't stream mp3. Seems it uses RTP: Real-time Transport Protocol. But compressed or uncompressed audio data?

(Last edited by scruffy on 13 Jun 2011, 15:54)

I think you are confused with MPD, Pulseaudio does not know anything about playlists. And there's no way on comparing a network filesystem with a (network) audio transport daemon.

Anyway, I am not going to defend the existence of Pulseaudio here any further, that is way out of scope on a OpenWRT forum. Features and cool setups can also be found using Google.

Now let's get back to topic please; the integration of Pulseaudio on OpenWRT. smile
I didn't have any success on the #alsa and #pulseaudio Freenode channel; it seems not so much people are active there.

gertvdijk wrote:

I think you are confused with MPD, Pulseaudio does not know anything about playlists. And there's no way on comparing a network filesystem with a (network) audio transport daemon.

Of course there is, I can try to understand the differences, the pros and cons, so that I know when to use what! That's the whole point.

Anyway, I am not going to defend the existence of Pulseaudio here any further, that is way out of scope on a OpenWRT forum. Features and cool setups can also be found using Google.

Maybe I am somebody who would give a f*ck and document some of the differences? You help me get a better grasp of it, and most probably you will find some more information in the wiki. But I guess, "use google" is also a strategy. ;-)

Now let's get back to topic please; the integration of Pulseaudio on OpenWRT. smile
I didn't have any success on the #alsa and #pulseaudio Freenode channel; it seems not so much people are active there.

Oh, I thought this is working the whole time. That's is why there is a wikipage: http://wiki.openwrt.org/doc/howto/pulseaudio

Because it is already working in OpenWrt, you only need a howto to get it working?

scruffy wrote:

Because it is already working in OpenWrt, you only need a howto to get it working?

To quote myself:

gertvdijk wrote:

However, when playing sound I get random stutters, clicks and other noises.

Besides, the how-to is not complete and things are not trivial.

And again, please stop the discussion on what Pulseaudio is. There's a lot of (noob-level) things you can find on the Internet since the introduction of Pulseaudio being the default in Ubuntu. The OpenWRT forum is not the place to discuss such things imo.

To continue my efforts to get acceptable sound quality, I've attached an other USB sound card (Sound Blaster Audigy 2 NX). It is recognized correctly and working the same way as the USB headset: stutter, clicks and noises.

[s]I'm working on filing a Trac ticket for this issue.[/s] Created a Trac ticket: #9560

(Last edited by gertvdijk on 13 Jun 2011, 19:02)

Hi, gertvdijk

I found this https://wiki.archlinux.org/index.php/PulseAudio - (on the lower part of the page) maybe it could address some of the problems you reported... Have not tried it myself, but though it seems related to your problem...

Nice work from loswillios and yourself.

-k

Thank you for spotting that page. I have tried some options mentioned there already, except for the one about tweaking module-udev-detect.

Another approach is currently building - latest trunk, it's the first update on the code since my first post here, so I hope that fixes some stuff as well.

While I was just about to flash latest trunk I found out just hours from now new interesting updates/patches are done in the pulseaudio area:
https://dev.openwrt.org/changeset/28044
https://dev.openwrt.org/changeset/28009

Building atm. Also saw tickets about the device being bricked, possibly. we'll see.

Build failed. Trac ticket: #9952

(Last edited by gertvdijk on 18 Aug 2011, 19:46)

gertvdijk wrote:

While I was just about to flash latest trunk I found out just hours from now new interesting updates/patches are done in the pulseaudio area:
https://dev.openwrt.org/changeset/28044
https://dev.openwrt.org/changeset/28009

Building atm. Also saw tickets about the device being bricked, possibly. we'll see.

Build failed. Trac ticket: #9952

I just ran the new pulseaudio (0.99.2) from trunk on my wl500gd deluxe running trunk from a few days ago but it will only give me:

E: [pulseaudio] main.c: Daemon startup failed.

No idea how to fix it, the previous one reported the same thing...

(Last edited by Wutje on 18 Aug 2011, 20:13)

Wutje wrote:
gertvdijk wrote:

While I was just about to flash latest trunk I found out just hours from now new interesting updates/patches are done in the pulseaudio area:
https://dev.openwrt.org/changeset/28044
https://dev.openwrt.org/changeset/28009

Building atm. Also saw tickets about the device being bricked, possibly. we'll see.

Build failed. Trac ticket: #9952

I just ran the new pulseaudio (0.99.2) from trunk on my wl500gd deluxe running trunk from a few days ago but it will only give me:

E: [pulseaudio] main.c: Daemon startup failed.

No idea how to fix it, the previous one reported the same thing...

Right I just found out I was running -1 not the -2 version you can't compile.

r28044 seemed broken. Reported the issue in #9952 and I was lucky to get that fixed by a developer within hours.
So r28045 built successfully. Pulseaudio installs *a lot* easier nowadays. Almost no configuration is needed (except for networking) after installing using opkg and things just work. Great work by developers here. I did report two additional shortcomings: #9955: "pulseaudio-tools paplay assertion" and #9956: "pulseaudio-tools depends on libdbus".

However, my original issue still exists: a lot of sound cracks, noises and stutter. Will gather more information and sound recordings later. My gut feeling here says it's a simple buffer issue regarding the Bi-endianess architecture of this device or the OpenWrt patches for the smaller memory footprint. To get that clear I am building for x86 at the moment and using USB-passthrough in a VM. Will report later.

(Last edited by gertvdijk on 19 Aug 2011, 00:42)

Hello -

I've installed latest trunk (29342) onto my wgt634u to try to get pulseaudio going on it.
Installed the pulse packages from opkg (didnt build them myself)
Its failing to start with a strange message:

/etc/init.d/pulseaudio start
...
I: [pulseaudio] main.c: Using runtime directory /var/run/pulse.
I: [pulseaudio] main.c: Using state directory /var/lib/pulse.
I: [pulseaudio] main.c: Using modules directory /usr/lib/pulse-1.1/modules.
I: [pulseaudio] main.c: Running in system mode: yes
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please note that you most likely shouldn't be doing that.
W: [pulseaudio] main.c: If you do it nonetheless then it's your own fault if things don't work as expected.
W: [pulseaudio] main.c: Please read http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode for an explanation why system mode is usually a bad idea.
I: [pulseaudio] main.c: Fresh high-resolution timers available! Bon appetit!
D: [pulseaudio] memblock.c: Using private memory pool with 1024 slots of size 4.0 KiB each, total size is 4.0 MiB, maximum usable slot size is 4056
D: [pulseaudio] cli-command.c: Parsing script '/etc/pulse/test.pa'
E: [pulseaudio] module.c: Failed to open module "module-udev-detect": file not found
E: [pulseaudio] main.c: Module load failed.
E: [pulseaudio] main.c: Failed to initialize daemon.
I: [pulseaudio] main.c: Daemon terminated.

Now the modules are all in /usr/lib/pulse-1.1/modules - which it says its using!!

Anyone else see this?  Any ideas?

Thanks

John

(Last edited by johncass on 28 Nov 2011, 11:10)

johncass wrote:

Hello -
E: [pulseaudio] module.c: Failed to open module "module-udev-detect": file not found
E: [pulseaudio] main.c: Module load failed.
E: [pulseaudio] main.c: Failed to initialize daemon.
I: [pulseaudio] main.c: Daemon terminated.

Now the modules are all in /usr/lib/pulse-1.1/modules - which it says its using!!
John

It looks like permission related. Pulseaudio was moved from user root to pulse recently. Can you show us an 'ls -lh /usr/lib/pulse-1.1/modules' before you try to chmod 755 those files?

Hi - thanks for helping
I'm just in process of replacing the opkg downloaded pulse with a home-built one.
But I had checked that; the modules were all owned by root:root and readable by all.
By the way, I tried to load a different module: module-cli and it worked!  I got a command line interface.
I then tried module-null-sink - it loaded, and module-loopback also loaded.
module-alsa-card, module-alsa-sink and module-udev-detect all failed to load with the same error.

It might be permissions on the sound devices /dev/snd/....
they are all root:root and readable only...

J

Hi -

Just to confirm, the modules in /usr/lib/pulse-1.1/modules were all root:root rwxr-xr-x (they were 755 already)
I tried chown pulse:pulse * and re-ran - no change

I also tried chown pulse:pulse /dev/snd/* - again no change, still getting the "Failed to open module ... file not found" error on module-alsa-* and module-udev-detect...

any other permissions might be in play - anything to do with libtool loading?

J

Hello,

managed to load-module module-tunnel-sink server=xxx.xxx.xxx.xxx
and then play-file file.wav 0
in the pulseaudio cli, and it worked!  played out on my other machine!
must be something around permissions re: alsa / sound card....

J

thanks, can you strace pulseaudio to find out where it fails?

hmmm...that's a bit above my paygrade - tell me what to do and I'll do it tho!
J

strace /usr/bin/pulseaudio --system -vvv

I think this is the relevant part:

looks like it successfully opens module-udev-detect.so but then closes it for some reason...

John


...
open("/etc/pulse/system.pa", O_RDONLY|O_LARGEFILE) = 7
ioctl(7, TIOCNXCL, 0x7fdc97e0)          = -1 ENOTTY (Inappropriate ioctl for device)
brk(0xc11000)                           = 0xc11000
fcntl64(7, F_GETFD)                     = 0
fcntl64(7, F_SETFD, FD_CLOEXEC)         = 0
read(7, "#!/usr/bin/pulseaudio -nF\n#\n# Th"..., 4096) = 2284
access("/usr/lib/pulse-1.1/modules/module-udev-detect.so", F_OK) = 0
ioctl(2, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
write(2, "D", 1D)                        = 1
write(2, ": ", 2: )                       = 2
write(2, "[pulseaudio] cli-command.c: ", 28[pulseaudio] cli-command.c: ) = 28
write(2, "Checking for existence of '/usr/"..., 85Checking for existence of '/usr/lib/pulse-1.1/modules/module-udev-detect.so': success) = 85
write(2, "\n", 1
)                       = 1
open("/usr/lib/pulse-1.1/modules/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/module-udev-detect.la", O_RDONLY) = -1 ENOENT (No such file or directory)
access("/usr/lib/pulse-1.1/modules/module-udev-detect.so", R_OK) = 0
open("/usr/lib/pulse-1.1/modules/module-udev-detect.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0777, st_size=19107, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2b30e000
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\300\23\0\0004\0\0\0"..., 4096) = 4096
old_mmap(NULL, 86016, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ba2a000
old_mmap(0x2ba2a000, 18724, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 8, 0) = 0x2ba2a000
old_mmap(0x2ba3e000, 2723, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 8, 0x4000) = 0x2ba3e000
close(8)                                = 0
munmap(0x2b30e000, 4096)                = 0
open("/lib/libpulsecore-1.1.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulsecore-1.1.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=510055, ...}) = 0
close(8)                                = 0
open("/lib/libltdl.so.7", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libltdl.so.7", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=30715, ...}) = 0
close(8)                                = 0
open("/lib/libspeexdsp.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libspeexdsp.so.1", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=68835, ...}) = 0
close(8)                                = 0
open("/lib/libpulse.so.0", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulse.so.0", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=281195, ...}) = 0
close(8)                                = 0
open("/lib/libjson.so.0", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libjson.so.0", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=21767, ...}) = 0
close(8)                                = 0
open("/lib/libpulsecommon-1.1.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulsecommon-1.1.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=343051, ...}) = 0
close(8)                                = 0
open("/lib/libsndfile.so.1", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("/usr/lib/libsndfile.so.1", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=418747, ...}) = 0
close(8)                                = 0
open("/lib/libudev.so.0", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libudev.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/pulse-1.1/modules/module-udev-detect.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0777, st_size=19107, ...}) = 0
close(8)                                = 0
open("/lib/libpulsecore-1.1.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulsecore-1.1.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=510055, ...}) = 0
close(8)                                = 0
open("/lib/libltdl.so.7", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libltdl.so.7", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=30715, ...}) = 0
close(8)                                = 0
open("/lib/libspeexdsp.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libspeexdsp.so.1", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=68835, ...}) = 0
close(8)                                = 0
open("/lib/libpulse.so.0", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulse.so.0", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=281195, ...}) = 0
close(8)                                = 0
open("/lib/libjson.so.0", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libjson.so.0", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=21767, ...}) = 0
close(8)                                = 0
open("/lib/libpulsecommon-1.1.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libpulsecommon-1.1.so", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=343051, ...}) = 0
close(8)                                = 0
open("/lib/libsndfile.so.1", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("/usr/lib/libsndfile.so.1", O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0755, st_size=418747, ...}) = 0
close(8)                                = 0
open("/lib/libudev.so.0", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libudev.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
ioctl(2, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
write(2, "E", 1E)                        = 1
write(2, ": ", 2: )                       = 2
write(2, "[pulseaudio] module.c: ", 23[pulseaudio] module.c: ) = 23
write(2, "\33[1;31m", 7)                = 7
write(2, "Failed to open module \"module-ud"..., 58Failed to open module "module-udev-detect": file not found) = 58
write(2, "\33[0m", 4)                   = 4
write(2, "\n", 1
)                       = 1
close(7)                                = 0
ioctl(2, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
write(2, "E", 1E)                        = 1
write(2, ": ", 2: )                       = 2
write(2, "[pulseaudio] main.c: ", 21[pulseaudio] main.c: )   = 21
write(2, "\33[1;31m", 7)                = 7
write(2, "Module load failed.", 19Module load failed.)     = 19
write(2, "\33[0m", 4)                   = 4
write(2, "\n", 1
)                       = 1
ioctl(2, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
write(2, "E", 1E)                        = 1
write(2, ": ", 2: )                       = 2
write(2, "[pulseaudio] main.c: ", 21[pulseaudio] main.c: )   = 21
write(2, "\33[1;31m", 7)                = 7
write(2, "Failed to initialize daemon.", 28Failed to initialize daemon.) = 28
write(2, "\33[0m", 4)                   = 4
write(2, "\n", 1
)                       = 1
munmap(0x2b62a000, 4194304)             = 0
ioctl(2, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
write(2, "I", 1I)                        = 1
write(2, ": ", 2: )                       = 2
write(2, "[pulseaudio] main.c: ", 21[pulseaudio] main.c: )   = 21
write(2, "Daemon terminated.", 18Daemon terminated.)      = 18
write(2, "\n", 1
)                       = 1
rt_sigaction(SIGHUP, {SIG_DFL, [], 0}, NULL, 16) = 0
rt_sigaction(SIGUSR2, {SIG_DFL, [], 0}, NULL, 16) = 0
rt_sigaction(SIGUSR1, {SIG_DFL, [], 0}, NULL, 16) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], 0}, NULL, 16) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], 0}, NULL, 16) = 0
close(5)                                = 0
close(6)                                = 0
close(3)                                = 0
close(4)                                = 0
umask(022)                              = 022
mkdir("/var/run/pulse", 0755)           = -1 EEXIST (File exists)
umask(022)                              = 022
open("/var/run/pulse", O_RDONLY|O_NOCTTY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFDIR|0755, st_size=60, ...}) = 0
getuid()                                = 51
getgid()                                = 51
fchown(3, 51, 51)                       = 0
fchmod(3, 0755)                         = 0
close(3)                                = 0
lstat64("/var/run/pulse", {st_mode=S_IFDIR|0755, st_size=60, ...}) = 0
open("/var/run/pulse/pid", O_RDWR|O_NOCTTY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC) = 3
fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
fcntl64(3, F_SETLKW64, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}, 0x7fdc97b8) = 0
fstat64(3, {st_mode=S_IFREG|0600, st_size=5, ...}) = 0
read(3, "1272\n", 19)                   = 5
read(3, "", 14)                         = 0
ftruncate64(3, 0)                       = 0
unlink("/var/run/pulse/pid")            = 0
fcntl64(3, F_SETLKW64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}, 0x7fdc98a0) = 0
close(3)                                = 0
exit_group(1)                           = ?