[PD] linux sound architecture

Frank Barknecht fbar at footils.org
Tue May 13 20:14:05 CEST 2008

Joseph Barrows hat gesagt: // Joseph Barrows wrote:

> this is not strictly PD;
> can someone inform me how sound works in linux ?
> i am very confused about alsa, jack, pulse, oss, <hardware device name>,

OSS is a name of the old soundcard drivers in the Linux kernel. With
these, soundcards were accessed by opening files like /dev/dsp0 and
writing samples to it. ALSA replaced OSS in kernels several years ago,
it uses a different way to let applications speak to the soundcard, but
it provides the old device files like /dev/dsp0 for
backwards-compatibility, so that old apps still work. ALSA uses
abstract, virtual device names like "hw:0" or "plughw:0" or "default" or
"mynicesoundcard" (yes, you can define your own names!). These names are
defined either internally or in a configuration file like
/etc/asound.conf or ~/.asoundrc

Pd was started when only OSS was available, so it has OSS decvice
support which is used over ALSA's OSS-emulation when you choose "OSS" as
audio system in Pd and have an ALSA kernel (you have one!), or use ALSA
directly by choosing ALSA in Pd. Pd over ALSA will try to use either
hw:X or plughw:X (with X being a number starting at 0 for your first

Now the next layer is Jack. As both ALSA and OSS don't provide a
(simple) way to connect applications together (they only deal with
soundcards) Paul Davis and others developed Jack. It usually uses the
ALSA system to access soundcards (but could use OSS as well) and with a
tool like "qjackctl" you can connect e.g. Pd to Ardour, when both are
running over jack. "jackd" is the Jack Server Daemon that has to be
running for this to work. As soon as jackd is running, it completely
takes over the soundcard, so non-jack apps cannot produce sound anymore. 

There are other sound servers similar to jack, but they aren't
targetting professtional audio production, so you generally won't see
them very often in the Pd world. PulseAudio is such a soundserver. Make
sure you only start one! Check with a process listing tool like "ps aux"

> I dont use audio a lot, but would love audio to work on my machine.  today
> PD cant connect to any audio (in or out) yesterday the mic input was stuck
> feeding through the speakers (without PD) but PD could get input (with a lot
> of noise).

"Not enough data. System shut down ..." 

If you can provide more info we might be able to help with that proble,.
Any error messages? 

> I want it to 'just work' ie all apps can access the inputs and all apps can
> access the outputs (mixed).

I'd recommend to use Jackd and only run Jack-aware applications.

> ideally there would also be the option of a PD like patching environment to
> re-patch a programs output to become another programs input (EG cd-audio out
> --> pd-audio in (fun patch)--> hardware line out

Somehow gstreamer tries to be this, it also supports jackd as backend.
But usually when doing music most Pd users I know don't want to be
surprised by "You have new mail!" sounds at full volume.

Frank Barknecht

More information about the Pd-list mailing list