this post was submitted on 04 Sep 2023
59 points (95.4% liked)

Linux

48137 readers
653 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

What are the main differences between pipewire and pulseaudio? Which one is better? What are other alternative popular sound servers besides these two?

all 49 comments
sorted by: hot top controversial new old
[–] bloopernova 50 points 1 year ago* (last edited 1 year ago) (1 children)

Pipewire is the new hotness. I've read comments from various audio engineers and programmers that pipewire "gets it right".

Pipewire came out in 2017, pulseaudio in 2004.

"PipeWire has received much praise, especially among the GNOME and Arch Linux communities. Particularly as it fixes problems that some PulseAudio users had experienced, including high CPU usage, Bluetooth connection issues, and JACK backend issues."

https://en.m.wikipedia.org/wiki/PipeWire

https://en.m.wikipedia.org/wiki/PulseAudio

[–] [email protected] 9 points 1 year ago* (last edited 1 year ago) (2 children)

Audio engineer here. Anything ALSA inherently does not "get it right". It's time for Linux to get HAL audio drivers

[–] bloopernova 13 points 1 year ago (2 children)

What sort of problems have you heard of or seen? I'd like to hear your different perspective, if that's ok with you?

[–] [email protected] 4 points 1 year ago (1 children)

Fewer kernel calls between hardware and software for loerw latency processing of audio is a must, there is a minimum amount of latency you can have with audio for anyone performing and that's debated by a total round trip time frame. From the second someone plays a note on say a guitar to the moment the resulting sound comes out of their speakers and into their ears is rather critical for timing.

Trouble is to do most anything with digital audio you require a buffer (here we add more latency) so that we can do the things we need to. Your audio device will have it's own buffer (and in the case of ALSA and Linux) your operating system will implement what's considered an audio "server" which will add is own buffer to route to whatever you are thinking you need to do and blah blah so on so forth. HAL drivers like ASIO mean you have much higher stability and much lower latency as you now have fewer buffers which is less added latency, fewer interruptus to deal with, and everything just kinda works in harmony. If you want to learn more consider first learning what ALSA is or any of the terms I originally used. I suggested starting with the wiki page where all of this is already explained

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (2 children)

Disclamer: I touched kernel driver development only for tiny TRNG driver for Rockchip SoC, but I mostly write user-space applications and did not touch audio directly as developer(only through OpenAL-soft).

Fewer kernel calls between hardware and software for loerw latency processing of audio is a must, there is a minimum amount of latency you can have with audio for anyone performing and that's debated by a total round trip time frame.

My eyes!

  1. There are no "kernel calls between hardware and software" normally. Well, Intel graphics drivers have execution requests, but that is definetly not what you wanted to say.
  2. Maybe you wanted to say fewer system calls? In that case I am sorry to disappoint you, but ALSA documentation states it has mapped ringbuffers, so it's already "zero" syscalls(preemption will still happen, but it is possible to make no context switches on multi-core system).
  3. Maybe you wanted to say fewer register updates? In that case the only solution is to make better drivers and better hardware.
  4. ALSA has much less latency than IPC-based APIs like JACK or Pulse.

Trouble is to do most anything with digital audio you require a buffer (here we add more latency) so that we can do the things we need to.

Correct, audiocards don't implement raw dac access because it is jittery shit.

Your audio device will have it's own buffer (and in the case of ALSA and Linux) your operating system will implement what's considered an audio "server" which will add is own buffer to route to whatever you are thinking you need to do and blah blah so on so forth.

And here you are mixing everything together to the point of being incorrect. ALSA is not audio server, it is audio userpace-to-driver api. You can opt for using audio server and you can opt to make alsa application to go through 11 out of 9 ring of hell to use audio server. There are two buffer at this point: one on your audio card(and you can do nothing about it) and one(or multiple "parallel" if mixing is enabled) in ALSA driver.

HAL drivers

Please stop adding more and more abstraction layers.

like ASIO

Ah, monopolistic(exclusive) mode. So many people complained about mixing being disabled by default, now people complain of it being enabled by default. I want to make a joke about OSS(deprecated API back in 90-ies).

mean you have much higher stability

ALSA is as stable as it gets. If your software is unable to keep-up with updates, then write software better.

and much lower latency as you now have fewer buffers which is less added latency, fewer interruptus to deal with,

So less latency or less interrupts? To reduce amount of interrupts you need to increase size of buffer and latency. Opposite is also true. You cannot say C and D both are less then A and B in A*B=C*D. At least using regular algebra.

If you want to learn more consider first learning what ALSA is or any of the terms I originally used. I suggested starting with the wiki page where all of this is already explained

Now I really want to know what you know about ALSA because it seems you don't know it well even as a user.

Funfact: you can force any application using ALSA to exclusive mode. Expect exclusive mode side-effects: no sound from other applications.

[–] [email protected] 0 points 1 year ago (1 children)

ASIO is not an audio server running in exclusive mode. I mean just there, that alone makes me understand you completely have no idea what you are talking about, the rest of the gibberish you spewed here is funny but that's the biggest red flag. Thank you my guy, for deciding not to research anything about this subject then write a nice long comment attempting to make my look like an idiot while doing no research at all and wasting my time and the time of anyone else reading here and making an attempt to worsen the Linux community in doing so. Bravo, thank you so much

[–] [email protected] 1 points 1 year ago (1 children)

ASIO is not an audio server running in exclusive mode.

I never said that. ASIO is a driver running in exclusive mode. ALSA is a driver, that just so happens to be able to run in exclusive mode. If you searched here for "Direct Read / Write transfer", then you would have seen this:

After application transfers the data in the memory areas, then it must be acknowledged the end of transfer via snd_pcm_mmap_commit() function to allow the ALSA library update the pointers to ring buffer. This kind of communication is also called "zero-copy", because the device does not require to copy the samples from application to another place in system memory.

[–] [email protected] 0 points 1 year ago (1 children)

ASIO is still not an audio driver running in exclusive mode, my brother in Christ how do you not understand this

[–] [email protected] 2 points 1 year ago

ASIO is still not an audio driver running in exclusive mode, my brother in Christ how do you not understand this

So you want to say ASIO has software mixing? Really?

[–] [email protected] -1 points 1 year ago

I don't know how you got so confused about this. Noting I said was incorrect to begin with you just love of made your own nonsense explanation for everything. I suggest doing some research on the subject. YIKES! Lemmy dunnings strike again

[–] [email protected] 1 points 1 year ago (1 children)

This got me curious what these acronyms were. I found this information interesting.

https://hal.science/hal-03116888/document

[–] [email protected] 14 points 1 year ago (2 children)

I suspect they meant “Hardware Abstraction Layer” for “HAL”

[–] [email protected] 8 points 1 year ago (1 children)

Well if they had actually added something other than "that bad, this good" we might actually know.

[–] [email protected] -1 points 1 year ago

I don't think it's entirely necessary to explain the entire topic in a simple lemmy comment about something that is so easy to search for and learn about.

[–] [email protected] 2 points 1 year ago (1 children)

Which is what any OS already is.

[–] [email protected] 1 points 1 year ago (1 children)

I’m assuming it’s a complaint about how low level ALSA is compared to the, E.G. Audio HAL in Android

[–] [email protected] 1 points 1 year ago (1 children)

Well, being low level is exactly what lets to extract better performance, lower latency and other good stuff.

[–] [email protected] 1 points 1 year ago (1 children)

There’s still a fine line to draw between usability and performance

ALSA is too low level for musicians to reasonably understand

Having something like PipeWire to make it easier to configure isn’t a bad thing

[–] [email protected] 1 points 1 year ago (1 children)

People here also are asking for super low-latency

[–] [email protected] 1 points 1 year ago (1 children)

That’s another nice thing about PipeWire.

It supports configuring JACK for you if you need low latency

[–] [email protected] 1 points 1 year ago (1 children)

One person above(Audbol) want to go even lower.

[–] [email protected] 1 points 1 year ago

You lost track of the conversation. That was about ALSA

[–] [email protected] 2 points 1 year ago (1 children)

Can you elaborate on what specifically makes ALSA bad, and what you mean by HAL audio drivers?

[–] [email protected] -2 points 1 year ago (1 children)

I answered below, you can also read on any of the ALSA pages as well as the wiki page for it. Wealth of knowledge on the subject is available

[–] [email protected] 1 points 1 year ago (1 children)

https://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html

After application transfers the data in the memory areas, then it must be acknowledged the end of transfer via snd_pcm_mmap_commit() function to allow the ALSA library update the pointers to ring buffer. This kind of communication is also called "zero-copy", because the device does not require to copy the samples from application to another place in system memory.

When you tell RTFM expect to see manual stating opposite of your point.

[–] [email protected] -1 points 1 year ago (1 children)

That's still not direct hardware, if you think you cracked the code then by all means show everyone otherwise, this would be a huge deal for a lot of people

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Not direct enough? It literally says it will send your buffer straight to soundcard without creating any additional buffers.

Other people under this post complain of ALSA being too direct.

[–] [email protected] 1 points 1 year ago
[–] [email protected] 27 points 1 year ago (3 children)

Pipewire is much better than Pulseaudio, especially for pro audio work because of its low latency. Another popular option is JACK, which must be used in conjunction with Pulseaudio. Harder to set up, but is also great for pro audio. Some audio engineers were having issues with Pipewire when it first came out so they went back to using JACK, but I think Pipewire has improved. Pipewire has been flawless on my end.

If you're not in pro audio or any kind of multimedia work, it doesn't really matter and you can just stick with whatever comes pre-configured on your distro. But my vote goes to Pipewire as the best server for pretty much anyone.

[–] [email protected] 6 points 1 year ago* (last edited 1 year ago) (1 children)

I have had some problems with PipeWire as JACK replacement, mostly it was some tearing artifacts that were very annoying. Recently though I learned how to use PipeWire (which is great for general desktop audio usage + works with Bluetooth really good) with JACK for pro-audio applications. By using the JACK DBus detect module it is possible to turn PipeWire into JACK client when ever the latter one is started.

So this way it is not required to use PulseAudio at all with JACK. There's also possibility to use PipeWire as JACK server because it also provides such API.

[–] [email protected] 4 points 1 year ago (1 children)

I’ve been running Pipewire in pro audio setup for my son and his band mates since the early days of the project. Granted I did run into some issues at first, but for a long time now it has been solid as a rock. With all of the plugins it is a joy to work with, no more Jack, Jack 2, Alsa, Pulse bridging and configuration nonsense, it all just ‘works’ now.

I would recommend it to anyone as a first option when setting up anything audio related on Linux now.

[–] [email protected] 1 points 1 year ago

I believe that PipeWire is really solid piece of software, but I couldn't just let go of JACK just yet. JACK just works and it's easy to modify important parameters like sample rate or buffer size. On PipeWire I still don't know how to quite do that, I get lost in all those configuration files, but I will get it someday.

Also one more thing that might be niche, but it's important for me is JACK timecode (for synching i.e. a DAW with video player) which PipeWire doesn't support at all at the moment. Getting it work on PipeWire (converting JACK timecode to LTC or MTC) gets ugly pretty quickly. So I'm glad PipeWire allows to use it however I like it, either as JACK server or client.

[–] [email protected] 2 points 1 year ago (1 children)

I think that's half true, Pulseaudio always was very buggy and a main reason for Linux bad reputation regarding none pro audio but most Distros switched already so if you use the default it will probably be Pipewire already.

[–] [email protected] 2 points 1 year ago

I don't even know why PA grew so much in the first place besides per-application volume control, unkept promises and straight lies.

[–] [email protected] 1 points 1 year ago

which must be used in conjunction with Pulseaudio

Why? Just why?

any kind of multimedia work, it doesn't really matter and you can just stick with whatever comes pre-configured on your distro. But my vote goes to Pipewire as the best server for pretty much anyone.

Or gaming. PulseAudio has insane latency. Use JACK or no server(that means use ALSA). Maybe Pipewire has tolerable latency, but I didn't test it myself.

[–] [email protected] 23 points 1 year ago

Tl;Dr use pipewire, it's just better and also handles screen capture on Wayland (which looks way better and has a much lower performance impact than X native screen capture in my experience)

[–] [email protected] 17 points 1 year ago

Pipewire seems to do everything better than PulseAudio, in my experience. It's stable, compatible with PulseAudio and JACK stuff, works for low latency stuff like music production, can be routed flexibly, etc... As someone who used to run a PulseAudio+JACK stack but has since replaced both with just PipeWire, I'm a big fan.

[–] [email protected] 16 points 1 year ago* (last edited 1 year ago)

Never had problems with pulseaudio, but pipewire solved all issues i had with Jack so best of both worlds! :)

[–] [email protected] 9 points 1 year ago

What are other alternative popular sound servers besides these two?

ALSA; low level, not really recommended to use directly. JACK; professional audio. GStreamer; idk exactly. Pipewire supports applications using any of those.

[–] [email protected] 6 points 1 year ago

Not directly answering your questions:

https://wiki.archlinux.org/title/PipeWire
I'm bad at describing so take the Arch wiki page.

You don't really have to worry about configuring much, it should be fine to install all the packages, maybe enable some services, and forget about it.

It's likely that you're not using Arch, so you'll have to check your distro's repos for the packages.

[–] [email protected] 5 points 1 year ago

Pipewire fixed some Bluetooth issues for me.

[–] [email protected] 1 points 1 year ago (2 children)

Pipewire is really buggy for me so I just use pulseaudio.

[–] [email protected] 3 points 1 year ago (1 children)

I had the opposite experience, Pulseaudio is a buggy pile of shit if you ask me!

[–] [email protected] 1 points 1 year ago (1 children)

Pipewire came installed by default on my OpenSUSE TW install and I never get audio in games. I have to constantly switch audio devices until it finally decides to work. I swapped it out for pulseaudio and I've never had an issue since.

[–] [email protected] 1 points 1 year ago

Strange, I had to manually restart Pulseaudio for months before I finally decided to switch to Pipewire, I guess Linux audio just still sucks!

[–] [email protected] 3 points 1 year ago

Pulseaudio was always buggy for me. I've only tried pipewire recently and so far I've had no issues.

The only downside is that (from having to do so much troubleshooting) I know more or less how to configure and tweak pulseaudio. If I ever decide to do weird sound things with pipewire, I'm starting from scratch.

[–] [email protected] -2 points 1 year ago* (last edited 1 year ago)

Read xkcd. To be fair it doesn't seem to create new audio api, but be alternative implementation.

I still recommend bare ALSA for average users. This includes gamers.