PAD(4)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’… PAD(4) β€” like, the Pseudo audio device driver page, bestie πŸŽ€

okay so this is section 4 of the Kernel Interfaces Manual β€” the Big Kernel Energy one β€” and the star of the show is pad. buckle up, it's actually so cool.


🌸 NAME 🌸

pad β€” the Pseudo audio device driver. that's it, that's the name, and honestly? iconic.


✨ SYNOPSIS ✨

pseudo-device pad
audio* at audiobus?

like, two lines. so chill. so powerful. 🫢


πŸ’– DESCRIPTION πŸ’–

okay so pad is a pseudo-device driver, which means it's not out here with real hardware β€” it's doing vibes-based work. specifically, it's the one that lets you feed back PCM data from whatever's consuming an audio(4) device, all the way back to us userland girlies. it's giving reverse uno card. it's giving "the audio comes back around." πŸ”₯

and the raw PCM data you can read from /dev/padN? it's encoded in stereo little-endian 16-bit linear PCM at 44100 Hz. no cap, that's the exact spec, don't come for me. ngl that's a whole lot of numbers but they all matter. πŸ’€


πŸŽ€ FILES πŸŽ€

so here's the little friendship bracelet situation: the pad pseudo-device driver receives data from /dev/audioN and then feeds the raw PCM output to /dev/padN. they're a duo. a package deal. main character energy, both of them. ✨

and here's the important deets: /dev/audioN is created once /dev/padN is opened. like, padN has to go first. it's the older sibling. periodt.

  • /dev/audioN
  • /dev/padN

πŸ¦‹ EXAMPLES πŸ¦‹

okay bestie, this is the part where it gets good. watch this. πŸ‘€

the following example streams an MP3 to an Apple AirTunes compatible device:

$ rtunes - < /dev/pad0 &
$ mpg123 -a /dev/audio1 mozart.mp3

like?? we're streaming mozart to an AirTunes thing through pad?? the way that works is genuinely so satisfying. πŸ“

and if you wanna record the output of an application (in this case, audioplay):

$ ffmpeg -f s16le -ar 44100 -ac 2 -i /dev/pad0 output.wav
$ audioplay -d /dev/audio1 input.wav

see those flags? s16le, ar 44100, ac 2 β€” that's the stereo little-endian 16-bit 44100 Hz thing from up top. it all ties together, iykyk. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘

that's the whole list. it only needs the one. quality over quantity, fr fr.


🌈 HISTORY 🌈

the pad driver appeared in NetBSD 5.0. vintage. retro. it's been slaying since day one. ⭐


πŸ’… AUTHORS πŸ’…

Jared D. McNeill <jmcneill@invisible.ca> β€” thank you for your service, king. 🫑


lowkey reminded: that PCM format is literally stereo little-endian 16-bit linear PCM at 44100 Hz β€” if you're writing a reader, don't forget, or it's gonna sound like a broken fax machine. 😭

Debian πŸŽ€ February 6, 2021 πŸŽ€ and that's the PAD(4) page, mwah πŸ’‹ go read audio(4) next, bestie, ily 🫢✨

πŸ“¦ where this page comes from