PAD(4)
π 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
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms