from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Still new to all of this? Feel free to post in any of the subforums on this site, but in this subforum newbie questions are especially encouraged!

Moderators: MattKingUSA, khz

User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

a very thorough write up by brother/sister reddit.com/user/_Spell_ over at reddit.com/r/linux:

A complete guide of and debunking of audio on Linux, ALSA and Pulse

Explains sampling rate, bit-depth, resampling, encoding, ALSA, Pulse, Jack. The approach is listening, not recording and editing, but solid starter info nevertheless.

Here's the TL:DR:
  • When you want to encode audio, prefer open, free formats like Ogg Vorbis. MP3 is not your friend.
  • Never encode a lossy format to another lossy format. Always try to encode from a 96kHz, 24-bit FLAC if you can.
  • Generally you won't have to touch PulseAudio, but there are a few things you can change in the /etc/pulse/daemon.conf file.
    • You can pick a different resampling method, see the manual for your options.
    • You should probably match the default-sample-* settings to your sound card.
    • Generally you shouldn't touch this file unless you are experiencing sound issues.
    • Do not set avoid-resampling to true, this is a huge misconception, this does not improve sound quality at best, and in the worst case, can actually break things.
As you can see, there's little you can do in Linux in the first place, so what can you do if you want better sound?
  • Buy a good external DAC, turning a digital signal into analog inside of a PC case is a bad idea due to electromagnetic interference. Ever plugged your headphones into the front audio jack of your case? You will hear the noise. A good DAC will make a meaningful improvement your listening experience.
  • Your headphones and amplifier really make the biggest difference. Having a good pair of headphones paired with a good headphone amplifier ten times more important than whatever chip you got in your PC.
MYTH: Linux sound quality is worse than Windows. They are exactly the same, Pulse doesn't work that different from how Windows does mixing and resampling.
MYTH: Linux sound quality can be better than Windows.
They are exactly the same. All improvements in quality come from the
driver and your DAC, not the sound server. Pulse and ALSA do not touch
the PCM beyond moving it around and resampling it.
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Linuxmusician01 »

Fmajor7add9 wrote:[...]
  • When you want to encode audio, prefer open, free formats like Ogg Vorbis. MP3 is not your friend.
Done reading. If you do not want to share your music files between friends or the other systems in your home (smart phone, Xbox, etc. etc.) then choose Ogg over MP3. Nobody uses Ogg.
tux99
Established Member
Posts: 346
Joined: Fri Sep 28, 2012 10:42 am
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by tux99 »

Furthermore all patents related to MP3 have expired, so MP3 is a free format these days (it has always been open).
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

Linuxmusician01 wrote:If you do not want to share your music files between friends or the other systems in your home (smart phone, Xbox, etc. etc.) then choose Ogg over MP3. Nobody uses Ogg.
True, sharing ogg (vorbis) is nothing but trouble. I do use it for some podcasts though and can play them on Windows Mobile and ancient Symbian (probably/maybe iOS & Android as well)
tux99 wrote:Furthermore all patents related to MP3 have expired, so MP3 is a free format these days (it has always been open).
wasn't aware of that, thanks

did a quick lookup, https://www.npr.org/sections/therecord/ ... 6645698091
Grill, director of that Fraunhofer division and one of the principals in the development of the MP3, told NPR over email that another audio format, AAC — or "Advanced Audio Coding," which his organization also helped create — is now the "de facto standard for music download and videos on mobile phones." He said AAC is "more efficient than MP3 and offers a lot more functionality."
from https://en.wikipedia.org/wiki/Advanced_Audio_Coding
...AAC generally achieves better sound quality than MP3 at the same bit rate.
...The quality for stereo is satisfactory to modest requirements at 96 kbit/s in joint stereo mode; however, hi-fi transparency demands data rates of at least 128 kbit/s (VBR). Tests of MPEG-4 audio have shown that AAC meets the requirements referred to as "transparent" for the ITU at 128 kbit/s for stereo
....No licenses or payments are required for a user to stream or distribute content in AAC format. This reason alone might have made AAC a more attractive format to distribute content than its predecessor MP3
....However, a patent license is required for all manufacturers or developers of AAC codecs. For this reason, free and open source software implementations such as FFmpeg and FAAC may be distributed in source form only, in order to avoid patent infringement.
....AAC patent holders include Bell Labs, Dolby, Fraunhofer, LG Electronics, NEC, NTT Docomo, Panasonic, Sony Corporation,[1] ETRI, JVC Kenwood, Philips, Microsoft, and NTT.[6]
aha, hmm...not sure what to make of that
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Linuxmusician01 »

Fmajor7add9 wrote:[...] aha, hmm...not sure what to make of that
There are a lot of formats that are better than MP3. MP3 was "invented" for the Video-CD (remember those? I do: awful!). But just like the VHS - Betamax - VCC2000 video cassette wars, in the end the most used one is the most useful. The quality differences can be overcome, the lack of support not. If you bought a good VHS video recorder back in the day and a brand new cassette you could achieve reasonable quality: the difference w/ VCC2000 was negligible in the end. Same goes for MP3: AAC may be better w/ the same bit rate, but on modern devices that doesn't matter much. First of all we listen to those music files through those awful in-ear headphones. Secondly, disk space is cheap now-a-days: just choose a higher bit rate for MP3 or use Flac (both resulting in larger files).

The discussion of which has the better quality is not very relevant if you ask me. Because that's a purely theoretical discussion whereas actually choosing a format is a practical choice. The difference in quality between formats is usually marginal and can be overcome easily. Having all your music, movies or documents in an unpopular format, however, is very hard to overcome.

Choose wisely. ;)
tux99
Established Member
Posts: 346
Joined: Fri Sep 28, 2012 10:42 am
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by tux99 »

Fmajor7add9 wrote:aha, hmm...not sure what to make of that
I'm not quite sure why you post quotes about AAC in reference to my statement about MP3.
AAC has nothing to do with MP3.

To confirm that MP3 is free nowadays (since 2017) just look at the Fedora statement here:
https://fedoramagazine.org/full-mp3-sup ... to-fedora/
Last edited by tux99 on Sat Aug 24, 2019 1:18 pm, edited 1 time in total.
User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by khz »

If you zap through the ~music with a headset on your smartphone in everyday life, the quality of the data.flac carrier.wav to be played back should be relatively unimportant. ;-)
. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by milo »

I used to be an ogg vorbis fanboy/snob from about 2002 to 2005. Vorbis is a great format, probably on par with AAC. But then I bought a 1st gen iPod shuffle, which was a great device for the money at the time. And iPod doesn't support vorbis, so that was that. There are still a few vorbis files lurking in my music collection, but not many.

Linuxmusician01 is right: format is a choice. A practical choice. Mp3 will get you playing on more devices than any other format, so it is my choice for the foreseeable future.
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

Linuxmusician01 wrote:
Fmajor7add9 wrote:[...] aha, hmm...not sure what to make of that
There are a lot of formats that are better than MP3. MP3 was "invented" for the Video-CD (remember those? I do: awful!). But just like the VHS - Betamax - VCC2000 video cassette wars, in the end the most used one is the most useful. The quality differences can be overcome, the lack of support not. If you bought a good VHS video recorder back in the day and a brand new cassette you could achieve reasonable quality: the difference w/ VCC2000 was negligible in the end. Same goes for MP3: AAC may be better w/ the same bit rate, but on modern devices that doesn't matter much. First of all we listen to those music files through those awful in-ear headphones. Secondly, disk space is cheap now-a-days: just choose a higher bit rate for MP3 or use Flac (both resulting in larger files).

The discussion of which has the better quality is not very relevant if you ask me. Because that's a purely theoretical discussion whereas actually choosing a format is a practical choice. The difference in quality between formats is usually marginal and can be overcome easily. Having all your music, movies or documents in an unpopular format, however, is very hard to overcome.

Choose wisely. ;)
Too late :) Tons of ogg gigs lying around. And I never listen to them these days, nor the mp3s.

Thanks for the rundown, interesting to learn more about the legacy format history.

Small note on ubiquitous disk space.
My 64gb SD card somehow died, so sad. My mobile devices are 16gb each and takes SD cards (up to 64, maybe more). I don't have any speakers that warrants Flac.

But there are still some reasons to not just 192Kbps everything:
  • lots of devices have limited storage and no SD slots
  • lots of their users don't have unlimited 3/4G mobile data 24/7.*
  • convenience, the more the card holds the longer between re-syncs
  • slightly less tear on the card/disk, thus longer life
  • sane targets, no reason to rip audio podcast from youtube any higher than 96k
  • resource management, the 'cloud' is pumping out more CO2 than air traffic, the day may soon come where every stream of media isn't almost free anymore. Proxy prepare.
  • same for just buying another storage gizmo (some Silicon Valley (the TV series) puns bubbling here at this screen)
  • agreed on slim quality margins on anything above 128K, but I do recall when MS had WMA 96k as default (in XP SP2?) and noticing the compression as 'worse' than my 192K mp3s and oggs
  • that's just about it, didn't manage the intended brief reply, sorry!
*(I once had a year with no broadband at home and a 4G 10gb cap per month but with uncapped spotify streaming on top; was great, got to hear much more albums than todays constant youtube/soundcloud/aso. playlisting or shuffle)
Last edited by Fmajor7add9 on Fri Aug 30, 2019 11:13 am, edited 1 time in total.
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

tux99 wrote:
Fmajor7add9 wrote:aha, hmm...not sure what to make of that
I'm not quite sure why you post quotes about AAC in reference to my statement about MP3.
AAC has nothing to do with MP3.
no reason, was just thinking and then writing out aloud. Apologies for the noise.
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

khz wrote:If you zap through the ~music with a headset on your smartphone in everyday life, the quality of the data.flac carrier.wav to be played back should be relatively unimportant. ;-)
guilty!

and a good, basic eq in the player apps is absolutely more important than source bitrate
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

milo wrote:I used to be an ogg vorbis fanboy/snob from about 2002 to 2005. Vorbis is a great format, probably on par with AAC. But then I bought a 1st gen iPod shuffle, which was a great device for the money at the time. And iPod doesn't support vorbis, so that was that. There are still a few vorbis files lurking in my music collection, but not many.

Linuxmusician01 is right: format is a choice. A practical choice. Mp3 will get you playing on more devices than any other format, so it is my choice for the foreseeable future.
Same, just never got the shuffle, but a 8gb Meizu M6 and going from portable FM radio and CD-R (anti skip! and burning and carrying CD-Rs around, 60-70 minutes each) to palm-sized self catered compressed music collection with 10+ hours of battery life was sen-sa-ti-o-nal.

But choosing ogg over mp3 a few years earlier was definately more ideological than played by ear, literally. Realplayer was still around and being used by many providers and I recall it as a time when noone was sure about future formats.
Last edited by Fmajor7add9 on Fri Aug 30, 2019 11:16 am, edited 1 time in total.
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by milo »

I forgot about RealPlayer! The last time I [...buffering...buffering...] thought abou [...buffering...buffering...] t RealPlayer was when they open sourced th[...buffering...buffering...]eir audio engine many years ago. I was [...buffering...buffering...]reading the comment stream on Slashdot about the story, and it was pr[...buffering...buffering...]etty entertaining. Some of the Linux developers were asking stuff like, "Exactly[...buffering...buffering...] why would we want to have the worst, most annoying, most spyware-laden media player EVER on our[...buffering...buffering...] platform?"

You are right. There were at least half a dozen viable format options floating around in those days. It looked like WMA was going to win for a while, then the smash success of the iPod made AAC the leader for a while, and vorbis was buried under all of that noise.
User avatar
Fmajor7add9
Established Member
Posts: 218
Joined: Sun Dec 31, 2017 3:56 am
Location: Might be moving to Montana soon
Has thanked: 48 times
Been thanked: 27 times
Contact:

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by Fmajor7add9 »

milo wrote:I forgot about RealPlayer! The last time I [...buffering...buffering...] thought abou [...buffering...buffering...] t RealPlayer was when they open sourced th[...buffering...buffering...]eir audio engine many years ago. I was [...buffering...buffering...]reading the comment stream on Slashdot about the story, and it was pr[...buffering...buffering...]etty entertaining. Some of the Linux developers were asking stuff like, "Exactly[...buffering...buffering...] why would we want to have the worst, most annoying, most spyware-laden media player EVER on our[...buffering...buffering...] platform?"

You are right. There were at least half a dozen viable format options floating around in those days. It looked like WMA was going to win for a while, then the smash success of the iPod made AAC the leader for a while, and vorbis was buried under all of that noise.
LOL! Buffer overflow, can't compute. Thanks for the laughs. Open Real Player, what a strange strange match, did they expect to sell codec infrastructure maintainence business speak something.

And just to keep the wheels rolling, now I'm discovering tiny webm bits when pulling youtube-dl -f

Code: Select all

249          webm       audio only DASH audio   50k , opus @ 50k, 5.80MiB
250          webm       audio only DASH audio   55k , opus @ 70k, 6.19MiB
251          webm       audio only DASH audio  101k , opus @160k, 11.36MiB
- which my shiny Windows phone apparently can't play.

/format out
User avatar
ufug
Established Member
Posts: 525
Joined: Tue Jan 10, 2012 12:28 am
Has thanked: 71 times
Been thanked: 22 times

Re: from reddit.com/r/linux: A complete guide of and debunking of audio on Linux, ALSA and Pulse

Post by ufug »

Ogg tangent: Discovering Rockbox and realizing I could "fix" the many limitations of the iPod is how I came to Linux in 2005. Putting the Rockbox firmware on the Pod instantly made it 10x more powerful. It could be themed, play games, play more file formats, and be managed like any mounted drive without being forced to use iTunes. It took about two days of using Rockbox before I looked sideways at my Mac and wondered if I could also "fix" that with something better than OSX...

I'm not anti-mp3, but I do have about a decade's worth of CDs ripped to ogg. Works for me. Ogg plays on Android and my three or four cheapo "mp3" players that have piled up over the years with no problem--I've never encountered a no-play scenario except for sharing with macwin people, and even they can play it with VLC (something mp3-sharing people are likely to have anyway). One of the reasons I love Bandcamp is because they offer high quality ogg downloads as an option. These days I tend to rip to FLAC since storage is cheap and I rip way less than I used to.

Anyway. The Reddit post is a good draft but it needs some repair, starting with the grammatically challenged title and incorporating some of the feedback in the thread. Hope _Spell_ will continue improving it as they have put a lot of work into it and it has the potential be a very helpful document for new arrivals!
listenable at c6a7.org
Post Reply