articles:linux_audio_explained

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
articles:linux_audio_explained [2021-08-20 18:26] Tonyarticles:linux_audio_explained [2021-08-20 20:55] (current) Tony
Line 1: Line 1:
 +====== Linux Audio Essentials ======
 +
 +This post is also in the form of a video blog. Watch the video first!
 +
 +  * Youtube: https://youtu.be/HxEXMHcwtlI
 +  * Peertube: https://peertube.tonytascioglu.com/videos/watch/4a6b4e74-a5af-4616-96f4-5d9773033152
 +
 +The description below is longer then the one on YouTube, which passed the maximum 5000 character limit.
 +The version here has all the full URLs and any extra comments I might add.
 +
 +===== Extra Insight =====
 +
 +In this video, I explain how audio and sound works on Linux based comptuers and systems.
 +More specifically, I go over the point of sound hardware, kernel drivers such as OSS and ALSA and userspace sound servers such as PulseAudio, Jack and Pipewire. 
 +
 +Along the way, I discuss the advantages and drawbacks of the current implementations, as well as why one implementation is often favored over another. 
 +Finally, I discuss the latest-and-greatest sound server, Pipewire, what it means, and how you can benefit from the improvements.
 +
 +This video is a bit rambly at times, so please stick with me, and I hope you learn something throughout and feed your curiosity.
 +Please feel free to use the timestamps below to skip between sections!
 +
 +
 +===== Timestamps =====
 +
 +
 +(grouped by topics)
 +
 +==== Introduction ====
 +
 +  * 00:00 - Introduction
 +
 +==== The Hardware ====
 +
 +  * 00:18 - Basic Hardware, Inputs and Outputs
 +  * 00:36 - Sound Cards (and what they do)
 +  * 01:01 - Digital Audio, PCM and extra hardware
 +
 +==== Kernel Drivers ====
 +
 +  * 01:29 - Kernel Drivers! (How to interact with hardware)
 +  * 01:53 - OSS (Open Sound System)
 +  * 02:12 - ALSA (Advanced Linux Sound Architecture) 
 +  * 02:46 - ALSA Limitations - hardware mixing/multiplexing
 +
 +==== Userspace Sound Servers ====
 +
 +  * 03:54 - Pulseaudio (and sound servers)
 +  * 04:25 - Benefits of PA - mixing and resampling
 +  * 07:26 - Drawbacks of PA (and JACK introduction)
 +  * 08:13 - JACK and its benefits
 +  * 09:57 - Comparison with PA and other software
 +
 +==== Pipewire (and ramble) ====
 +
 +  * 11:12 - Pipewire (and its benefits)
 +  * 14:05 - Future of Pipewire
 +  * 15:17 - Note on Bluetooth (rant)
 +- note: mostly fixed!
 +
 +  * 17:52 - Conclusion
 +
 +
 +===== Links (and references) =====
 +
 +==== Sound Cards ====
 +
 +  * https://en.wikipedia.org/wiki/Sound_card
 +
 +==== Check ALSA compatibility of a sound card ====
 +
 +  * https://www.alsa-project.org/wiki/Matrix:Main
 +
 +==== DAC and ADC ====
 +
 +  * https://www.ramelectronics.net/analog-digital.aspx
 +  * https://en.wikipedia.org/wiki/Digital-to-analog_converter
 +
 +==== Nyquist Shannon sampling theorem ====
 +
 +  * I didn't get to it in this video, but it explains why 44.1 and 48 kHz are perfectly fine.
 +  * More specifically, how we can perfectly reconstruct analog waves provided no aliasing and they are below the nyquist frequency.
 +  * https://www.allaboutcircuits.com/technical-articles/nyquist-shannon-theorem-understanding-sampled-systems/
 +
 +==== Chris Montgomery Videos ====
 +
 +  * I found these super helpful to understand digital audio and video fundamentals.
 +  * Discusses PCM and more, and also the nyquist stuff from above in video 2.
 +  * https://www.xiph.org/video/
 +  * https://wiki.xiph.org/A_Digital_Media_Primer_For_Geeks_%28episode_1%29
 +  * https://wiki.xiph.org/Digital_Show_and_Tell/Episode_02
 +
 +  * Also see Chris' blog while you're at it, some interesting reads:
 +  * https://xiphmont.dreamwidth.org/
 +
 +==== Kernel Driver Architecture ====
 +
 +  * I found this a simple overview when researching
 +  * https://events19.linuxfoundation.org/wp-content/uploads/2017/12/Introduction-to-Linux-Kernel-Driver-Programming-Michael-Opdenacker-Bootlin-.pdf
 +
 +==== OSS ====
 +
 +  * https://en.wikipedia.org/wiki/Open_Sound_System
 +  * https://wiki.archlinux.org/title/Open_Sound_System
 +
 +  * ie: OSS wasn't bad, and had some afvantages over ALSA, but the licensing switch just prompted people to switch
 +  * https://en.wikipedia.org/wiki/Open_Sound_System#Free,_proprietary,_free
 +
 +==== ALSA ====
 +
 +https://www.alsa-project.org/wiki/Main_Page
 +
 +  * The sound card compatibility list is above. The Gentoo and Arch wiki entries are useful.
 +  * https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture
 +  * https://wiki.gentoo.org/wiki/ALSA
 +
 +==== Sound card multiplexing ====
 +
 +  * https://en.wikipedia.org/wiki/Sound_card_mixer
 +  * https://newbedev.com/why-do-you-need-pulseaudio
 +
 +  * Use a sound server. Don't do this manually https://electronics.stackexchange.com/questions/57476/how-do-i-multiplex-many-signals-into-my-sound-card
 +
 +==== Pulseaudio ====
 +
 +  * Homepage: https://www.freedesktop.org/wiki/Software/PulseAudio/
 +  * User docs: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User
 +  * Git: https://gitlab.freedesktop.org/pulseaudio/pulseaudio
 +
 +  * As usual, the arch page and examples are good:
 +  * https://wiki.archlinux.org/title/PulseAudio
 +  * https://wiki.archlinux.org/title/PulseAudio/Examples
 +
 +==== Jack ====
 +
 +  * Homepage: https://jackaudio.org/
 +  * Jack1 git: https://github.com/jackaudio/jack1
 +  * Jack2 git: https://github.com/jackaudio/jack2
 +  * Wiki (and tools using Jack) https://github.com/jackaudio/jackaudio.github.com/wiki
 +  * Archwiki: https://wiki.archlinux.org/title/JACK_Audio_Connection_Kit
 +
 +==== Pipewire ====
 +
 +  * Hoempage: https://pipewire.org/#about
 +  * Neat demo and features, and other benefits discussed on hackaday here: https://hackaday.com/2021/06/23/pipewire-the-newest-audio-kid-on-the-linux-block/
 +  * Archwiki as always: https://wiki.archlinux.org/title/PipeWire
 +  * Wiki - contains useful config parameters for pulse and jack: https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home
 +  * Git: https://gitlab.freedesktop.org/pipewire/pipewire
 +
 +==== Firewire ====
 +  * 
 +  * If you have one, your best bet is http://www.ffado.org/
 +
 +
 +===== Notes =====
 +
 +  * 0040 - When I say sound card, most computers have one build in these days, eg: onboard audio. Physical discrete cards are mostly a thing of the past.
 +  * 0250 - Sound card multiplexing also often called hardware mixing.
 +  * 1240 - There is also a "Pro Audio" mode for sound cards that splits all the channels
 +  * 1705 - Most of these disconnection issues are now fixed as of the time of publishing!
 +
 +  * I'll add more notes as I remember when rewatching this.
 +
 +  * Please note that due to classes and school and coop, the filming/editing/uploads of my videos are very delayed, and might not be the most sensitive. This video was filmed April 2021, Edited June-July 2021, Description written August 2021. I hate writing descriptions and thumbnails...
 +
 +
 +===== Contact me =====
 +
 +Watch this video on Peertube: https://peertube.tonytascioglu.com
 +More info is probably on my wiki: https://wiki.tonytascioglu.com
 +
 +Copyright 2021 - Tony Tascioglu
 +I'm making this freely available under a CC-BY-SA-NC.
 +
 +Email: tonytash@pm.me (not monitored 24/7)
 +I might not get to comments on this video until the end of my next school/work term, feel free to post anyways.
 +
 +I hope you enjoyed the video and learned something!
 +
 +==== Shoutouts ====
 +
 +Randy MacLeod (and the rest of the Wind River Linux userspace team). I know you had asked me about Pipewire at some point, and I already had this video in the works, so hopefully you find it useful :)
 +
 +===== Corrections =====
 +
 +  * I'll update this as corrections are pointed out.