|SNDIOD(8)||System Manager's Manual||SNDIOD(8)|
sndioddaemon is an intermediate layer between audio or MIDI programs and the hardware. It performs the necessary audio processing to allow any program to work on any supported hardware. By default,
sndiodaccepts connections from programs running on the same system only; it initializes only when programs are using its services, allowing
sndiodto consume a negligible amount of system resources the rest of the time. Systems with no audio hardware can use
sndiodto keep hot-pluggable devices usable by default at virtually no cost.
sndiodoperates as follows: it exposes at least one sub-device that any number of audio programs can connect to and use as if it was audio hardware. During playback,
sndiodreceives audio data concurrently from all programs, mixes it and sends the result to the hardware device. Similarly, during recording it duplicates audio data recorded from the device and sends it to all programs. Since audio data flows through the
sndiodprocess, it has the opportunity to process audio data on the fly:
sndiodexposes MIDI thru boxes (hubs), allowing programs to send MIDI messages to each other or to hardware MIDI ports in a uniform way. Finally,
sndiodexposes a control MIDI port usable for:
sndiodopens the audio device or the MIDI port only when needed or keeps it open all the time. If the flag is on then the audio device or MIDI port is kept open all the time, ensuring no other program can steal it. If the flag is off, then it's automatically closed, allowing other programs to have direct access to the audio device, or the device to be disconnected. The default is off.
-z), if the block size is set.
-aberwz) apply to this device. Sub-devices (
-s) that are applied after will be attached to this device. Device mode and parameters are determined from sub-devices attached to it.
sndiodshould listen on;
sndiodwill listen on TCP port 11025+n, where n is the unit number specified with
-U. Without this option,
sndiodlistens on the UNIX-domain socket only, and is not reachable from any network. If the option argument is ‘-’ then
sndiodwill accept connections from any address. As the communication is not secure, this option is only suitable for local networks where all hosts and users are trusted.
sndiodinstead of the physical audio device for audio input and output in order to share the physical device with other clients. Defining multiple sub-devices allows splitting a physical audio device into sub-devices having different properties (e.g. channel ranges). The given name corresponds to the “option” part of the sndio(7) device name string.
sndiod. If the mode is off (the default), then programs are not affected by MMC messages. If the mode is slave, then programs are started synchronously by MMC start messages; additionally, the server clock is exposed as MIDI Time Code (MTC) messages allowing MTC-capable software or hardware to be synchronized to audio programs.
sndiodserver instance has an unique unit number, used in sndio(7) device names. The default is 0.
sndiodbehaviour when the maximum volume of the hardware is reached and a new program starts playing. This happens only when volumes are not properly set using the
-voption. If the flag is on, then the master volume is automatically adjusted to avoid clipping. Using off makes sense in the rare situation where all programs lower their volumes. The default is on.
-toption, and MTC is used for synchronization, the clock resolution must be 96, 100 or 120 ticks per second for maximum accuracy. For instance, 100 ticks per second at 48000Hz corresponds to a 480 frame block size. The default is 960 or half of the buffer size (
-b), if the buffer size is set.
-aberwz) must precede the device definition (
-f), and per-sub-device parameters (
-Ccjmtvx) must precede the sub-device definition (
-s). Sub-device definitions (
-s) must follow the definition of the device (
-f) to which they are attached. If no audio devices (
-f) are specified, settings are applied as if the default device is specified. If no sub-devices (
-s) are specified for a device, a default sub-device is created attached to it. If a device (
-f) is defined twice, both definitions are merged: parameters of the first one are used but sub-devices (
-s) of both definitions are created. The default sndio(7) device used by
sndiodis rsnd/0, and the default sub-device exposed by
sndiodis snd/0. If
SIGTERM, it terminates. By default, when the program cannot accept recorded data fast enough or cannot provide data to play fast enough, the program is paused, i.e. samples that cannot be written are discarded and samples that cannot be read are replaced by silence. If a sub-device is created with the
-toption, then recorded samples are discarded, but the same amount of silence will be written once the program is unblocked, in order to reach the right position in time. Similarly silence is played, but the same amount of samples will be discarded once the program is unblocked. This ensures proper synchronization between programs.
sndiodcreates a MIDI port with the same name as the exposed audio sub-device to which MIDI programs can connect.
sndiodexposes the audio device clock and allows audio device properties to be controlled through MIDI. A MIDI channel is assigned to each stream, and the volume is changed using the standard volume controller (number 7). Similarly, when the audio client changes its volume, the same MIDI controller message is sent out; it can be used for instance for monitoring or as feedback for motorized faders. The master volume can be changed using the standard master volume system exclusive message. Streams created with the
-toption are controlled by the following MMC messages:
sndiodclients, but the given time position is sent to MIDI ports as an MTC “full frame” message forcing all MTC-slaves to relocate to the given position (see below).
sndiodwaits for all streams to become ready to start, and then starts them synchronously. Once started, new streams can be created (
sndiod) but they will be blocked until the next stop-to-start transition.
-toption export the
sndioddevice clock using MTC, allowing non-audio software or hardware to be synchronized to the audio stream. Maximum accuracy is achieved when the number of blocks per second is equal to one of the standard MTC clock rates (96, 100 and 120Hz). The following sample rates (
-r) and block sizes (
-z) are recommended:
$ sndiod -r 48000 -z 400 -s default -t slave -s mmc
$ sndiod -s default -c 2:3 -s rear
$ sndiod -v 65 -s default -v 127 -s max
$ sndiod -r 48000 -b 480 -z 240
-aoff is used,
sndiodcreates sub-devices to expose first and then opens the audio hardware on demand. Technically, this allows
sndiodto attempt to use one of the sub-devices it exposes as an audio device, creating a deadlock. There's nothing to prevent the user from shooting himself in the foot by creating such a deadlock.
|January 18, 2016||OpenBSD-current|