Hacker News new | ask | show | jobs
by functionmouse 55 days ago
whoa, bit perfect CD/flac playback in 44.1, that's a killer feature.
2 comments

There are many audio resampling libraries available that can convert from 44.1 to 48 kHz with no perceptible quality loss. E.g. see

https://github.com/hasenbanck/resampler#quality-analysis

This is presumably what Apple does. You kind of have to anyway or you have the stupid situation Linux used to have where only one app could play audio at a time.

Hardware often reports supporting 44.1kHz but internally resamples it to 48kHz so you're better off properly resampling it yourself.
> you have the stupid situation Linux used to have where only one app could play audio at a time

When was that? I think my first Linux distribution was Ubuntu 8.04 and fairly sure it shipped with PulseAudio which in mind always been able to play audio from multiple sources at the same time, maybe I misremember?

Pure ALSA would behave like that because the currently playing process would take exclusive control of the hardware.

Upsite: Highest quality playback.

Downside: Only one process could play audio at a time.

Only if you had no hardware nor software mixing configured, which probably should be considered a misconfiguration of your system.
ALSA had dmix for some time already, but the default configuration of your distro may not have enabled it.
As I recall it was rarely enabled by default and was a pain to set up so in practice not really used.

The most common solution at the time was PulseAudio, which was so bad it usually was better to just use direct ALSA and live with the idiotic one-at-a-time limitation.

Thankfully Pipewire seems to actually work reliably so I guess that's at least one thing ticked off the Year of the Linux Desktop checklist.

It was the default on Gentoo long before Pulseaudio was the default anywhere. If other distros messed up their config I cannot say but the fixing that would have been a lot easier than moving to an entirely different system with an incompatible application interface.
Most distributions shipped ALSA preconfigured with dmix, which means multiple applications could play sound at the same time just fine.

Which is why the whole "we must use pulseaudio even if it's terrible and has awful standards that blast volume or multiple streams won't work!" was so weird… everybody who tried knew that just removing pulseaudio the multiple streams kept working :)

So only those who never applied the scientific method kept insisting that without PA it was not possible to do that.

I think PA allows for setting applications volumes and have a modular design. But it's kinda the poster child of overengineering (challenged by systemd now). Something like sndiod is more sensible for most desktop distro. People that need a more complex setup can bring in the big gun like pipewire.
I don't think the problem was over-engineering. I think the problem was that if you plugged in headphones it would instantly set the volume to 100% from whatever value it was before.

Plus of course, initially you had to regularly run killall -9 pulseaudio to fix the sound. All in a moment when ALSA with dmix worked just fine.

Sometimes I think fedora and ubuntu are trying to hinder linux as mainstream desktop.

There was a time when OSS was the only option and ALSA was rarely supported by software. ALSA's dmix also didn't exist from the start.

Around 2000 I was only able to play sound from different apps because my soundcard exposed two sound devices /dev/dsp0 and /dev/dsp1

In the time before PulseAudio, when it was ALSA (and OSS).
Even back then, it could play more than one stream. You had to have a sound card or kernel drivers that supported it (and all non-obsolete ones did by the time pulse audio came out).

I still don’t know what purpose pulseaudio serves, other than adding latency and making stuff less reliable.

PipeWire is better, but it turns out you can just use OSS under freebsd these days, and everything just works, but with lower latency.

If you have some sort of potato sound card that can’t mix output channels in hardware, note that OSS added sw mixing by 2007 (with support for 16 channels by default).

Sure, sure. I remember a time when I didn't have a sound card that supported it and couldn't play multiple streams at a time; this is a thing that really happened. I did eventually go out and buy a soundcard to enable multiple streams.
Nonsense - HDA systems were overwhelmingly the majority of Linux systems at that point, and didn't have any hardware support for multiple streams. OSS with software mixing was a commercial product that wasn't upstream. ALSA had userspace mixing but it was very much not an out of the box experience, and didn't take advantage of hardware capabilities in the way Pulseaudio did to reduce wakeups and power consumption.
ALSA had DMIX by default, all that before Pulseaudio. I remember Knoppix and a few more doing that.
Do you think starting with "Nonsense" makes your argument better heard?
If you have two audio streams, you can't play them as is on the audio device, you have to mix them together. The same happens with analog speakers as you can't just add two signals together. I believe at one point with Alsa, when an application takes control of the audio device, no one else could play with it. Now Alsa comes with dmix (a digital mixer feature) enabled in its default configuration, so two applications may play how they want. And we have PulseAudio, Jack, and Pipewire on top of Alsa to add more features.

OpenBSD still present raw audio devices, but they have sndio which provides a more helpful interface for applications including resampling (not the best algorithms there, according to them).

Well, good enough it you read the OpenBSD FAQ section on Multimeda for RT throughput and the like.
Came later I believe. They had esd and other sound “servers” back then however. Might have had to install it yourself.
No its not. You wont be able to hear the difference between 44.1 vs 48.