SNDIO(7) | Miscellaneous Information Manual | SNDIO(7) |
sndio
— interface
to audio and MIDI
The sndio
audio and MIDI system provides
access to audio and MIDI hardware and to services provided by
sndiod(8), summarized below.
Hardware audio(4) devices correspond to peripherals. Only one application may use any device at a given time. Generally a limited number of encodings, sample rates and channel numbers are supported by the hardware, which may not meet the requirements of audio programs.
To overcome hardware limitations and to allow multiple applications to share the hardware, sndiod(8) can be used. It exposes one or more software sub-devices backed by the underlying hardware, while doing all necessary conversions on the fly. It can mix multiple streams or split the hardware into multiple sub-devices, to allow programs to use the hardware concurrently.
Hardware MIDI ports correspond to serial connectors provided by the midi(4) driver. They are typically used to access MIDI hardware (synthesizers, keyboards, control surfaces, etc.), but they do not allow applications to exchange information using the MIDI protocol.
Software MIDI thru boxes allow one application to send MIDI data to other applications connected to the thru box (for instance a software sequencer can send events to multiple software synthesizers). There's no hardware involved: thru boxes are created by sndiod(8).
Additionally, sndiod(8) exposes a MIDI port used to control and monitor audio streams in real time using MIDI.
From the user's perspective every audio interface, MIDI port, and sndiod(8) service has a name of the form:
type[@hostname][,unit]/devnum[.option]
This information is used by audio and MIDI applications to determine how to access the audio device or MIDI port.
-U
option of sndiod(8). Useful
only if multiple sndiod(8) servers are running on the
same system.-fq
option on the command line.-s
option of sndiod(8).For example:
rsnd/0
rmidi/5
snd/0
snd/0.rear
-s
rear.midithru/0
If default
is used as the audio device,
the program will use the one specified in the
AUDIODEVICE
environment variable. If it is not set,
the program first tries to connect to snd/0
. If that
fails, it then tries to use rsnd/0
. This allows the
sndiod(8) audio server to be used by default and the bare
hardware as fallback; programs don't have to be reconfigured when
sndiod(8) is started or stopped.
If default
is used as the MIDI port, the
program will use the one specified in the MIDIDEVICE
environment variable. If it is not set, the program first tries to connect
to midithru/0
. If 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 configuration required.
If a shared sndiod(8) server is running, for privacy reasons only one user may have connections to it at a given time (though the same user could have multiple connections to it). Users are identified by their session cookie, which is automatically generated by audio or MIDI applications 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.
AUDIODEVICE
MIDIDEVICE
These environment variables are ignored by
sndio
if the program has the set-user-ID or
set-group-ID bits set.
June 19, 2024 | Debian |