|SNDIO(7)||Miscellaneous Information Manual||SNDIO(7)|
sndio — audio and
MIDI device descriptors
Programs access audio and MIDI hardware using the
sndio library. It allows both access through the
sndiod(8) server and raw access to the
hardware. The audio device or MIDI port, as well as the access method, are
designated by the sndio descriptor. It is provided by the user with the
program device selection method, or with the
environment variables if there's no device selection method.
Usually, programs access the hardware via the sndiod(8) server, because raw access to the hardware is exclusive and requires additional privileges. The sndiod(8) server supports multiple connections at a time, allowing multiple programs to use the hardware concurrently. It performs the necessary audio processing on the fly to overcome any incompatibility between software and hardware. Connections to sndiod(8) may also be established through the network, including from virtual machines.
Additionally, sndiod(8) exposes a MIDI port used to control audio programs using standard MIDI Machine Control (MMC), MIDI Time Code (MTC), and master volume messages.
From the user's perspective, every audio device or MIDI port exposed by sndiod(8) has a descriptor of the form:
This information is used by programs to determine how to access the audio device or MIDI port.
-Uoption of sndiod(8). Useful only if multiple sndiod(8) servers are running on the same system.
-qoption on the sndiod(8) command line.
-soption of sndiod(8).
Every raw audio device or MIDI port has a descriptor of the form:
The type can be either
rmidi. The rsnd/0
device descriptor accesses the /dev/audio0 device,
rsnd/1 accesses /dev/audio1, and so on. Similarly,
rmidi/0 accesses /dev/rmidi0 and so on.
When no audio device descriptor is provided to a program or when
the reserved word
default is used as the audio
device, the program will use the one specified in the
AUDIORECDEVICE environment variables. If they
are not set, the program first tries to connect to
snd/0. If that fails, it then tries to use
Similarly, if no MIDI descriptor is provided to a program or when
the reserved word
default is passed as the device
descriptor, the program uses the one specified in the
MIDIDEVICE environment variable. If it is not set,
the program first tries to connect to
that fails, it then tries to use
rmidi/0. As long as
sndiod(8) is running, this allows
programs to exchange MIDI data on machines with no MIDI hardware by default,
e.g. a MIDI player could use a software synthesizer with no manual
For privacy reasons only one user may have connections to sndiod(8) at a given time. Users are identified by their session cookie, which is automatically generated by audio or MIDI programs upon the first connection to the server. The cookie is stored in $HOME/.sndio/cookie and contains 128 bits of raw random data.
If a session needs to be shared between multiple users, they can connect to the server using the same cookie.
These environment variables are ignored by
sndio if the program has the set-user-ID or
set-group-ID bits set.
-foption of sndiod(8).
|November 20, 2020||OpenBSD-current|