SNDIOD(8)
π§ SNDIOD(8) β System Manager's Manual π§
okay bestie, gather round, because we are talking about sndiod from the System Manager's Manual, and she is that girl. this is the audio/MIDI server situation and honestly? she's the backbone of your whole sound setup. no cap. π
β¨ NAME β¨
sndiod β audio/MIDI server π
like, the literal audio and MIDI server. she does both. main character energy fr fr. π¦
β¨ SYNOPSIS β¨
lowkey the whole vibe in one code block, bestie. every flag, every argument, exactly as written:
sndiod [-d] [-a flag] [-b nframes] [-C min:max] [-c min:max] [-e enc]
[-F device] [-f device] [-j flag] [-L addr] [-m mode] [-Q port]
[-q port] [-r rate] [-s name] [-t mode] [-U unit] [-v volume]
[-w flag] [-z nframes]
so yeah. that's a lot of little knobs and dials and honestly the way she just lines them all up like that? obsessed. πβ¨
here's the quick rundown of what each of those lil cuties is doing up there, so you're not just staring at brackets like π:
-dβ a lone flag, no argument, just vibing by itself πΈ-aflagβ takes aflagargument-bnframesβ takes annframesvalue-Cmin:maxβ takes amin:maxrange, colon and all, don't lose the colon bestie π-cmin:maxβ same deal, anothermin:maxrange-eencβ takes anencargument-Fdeviceβ takes adevice(capital F, do NOT confuse her with lowercase f, they are different girls) π-fdeviceβ also takes adevice, lowercase f this time-jflagβ takes aflag-Laddrβ takes anaddr(capital L, again, distinct from lowercase l energy, but there's no lowercase l here so we're safe π)-mmodeβ takes amode-Qportβ takes aport(capital Q, she's loud)-qportβ takes aport(lowercase q, she's chill) π-rrateβ takes arate-snameβ takes aname-tmodeβ takes amode-Uunitβ takes aunit-vvolumeβ takes avolume-wflagβ takes aflag-znframesβ takes annframesvalue
bestie PSA: that's all just the synopsis, okay? we are literally at the very top of the page. the actual tea about what every single one of these does is coming. don't skip ahead. π«Ά
that's the header + NAME + SYNOPSIS handled. more of her is coming, so stay tuned, we are NOT done. π
β¨ DESCRIPTION β¨
Okay bestie, so the sndiod daemon is literally the middle layer between your audio or MIDI programs and the actual hardware π. It does all the audio processing necessary so that any program can work on any supported hardware. Iconic behaviour, no cap.
By default, sndiod only accepts connections from programs running on the same system. And here's the cute part: it only wakes up and initializes when programs are actually using its services, so the rest of the time it consumes a negligible amount of system resources π¦. Systems with no audio hardware at all can still use sndiod to keep hot-pluggable devices usable by default at virtually no cost. Slay.
Here's how it operates, bestie: it exposes at least one sub-device that any number of audio programs can connect to and use as if it was real 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 the audio data recorded from the device and sends it to all programs π.
And because the audio data literally flows through the sndiod process, it gets to process audio data on the fly:
- Change the sound encoding to overcome incompatibilities between software and hardware π.
- Route the sound from one channel to another, join stereo or split mono π¦.
- Control the per-application playback volume as well as the master volume π .
- Monitor the sound being played, allowing one program to record what other programs play π.
Processing is configured on a per sub-device basis, meaning the sound of all programs connected to the same sub-device gets processed according to the same configuration. Multiple sub-devices can be defined, letting multiple configurations coexist π«Ά. The user picks which configuration a given program uses by selecting the sub-device that program uses.
sndiod also exposes MIDI thru boxes (hubs), letting programs send MIDI messages to each other or to hardware MIDI ports in a uniform way πΉβ¨.
And finally, sndiod exposes a control MIDI port usable for:
- Volume control π.
- Common clock source for audio and MIDI programs β°.
- Start, stop and relocate groups of audio programs ποΈ.
π The options, one by one (yes, all of them)
The options are as follows:
-aflagβ controls whethersndiodopens the audio device or the MIDI port only when needed, or keeps it open all the time. If the flag is on, the audio device or MIDI port stays 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.-bnframesβ the buffer size of the audio device in frames. Heads up: a frame consists of one sample for each channel in the stream. This is the number of frames that will be buffered before being played, so it controls the playback latency β±οΈ. The default is7680, or twice the block size (-z), if the block size is set.-Cmin:max,-cmin:maxβ the range of channel numbers for recording and playback directions respectively that any client is allowed to use. This is a subset of the audio device channels. The default is0:1, i.e. stereo π§.-dβ enable debugging to standard error, and do not disassociate from the controlling terminal. Can be specified multiple times to further increase log verbosity π (spam it if you need to, bestie).-eencβ attempt to configure the device to use this encoding. The default iss16. Encoding names use the following scheme: signedness (soru) followed by the precision in bits, the byte-order (leorbe), the number of bytes per sample, and the alignment (msborlsb). Only the signedness and the precision are mandatory β¨. Examples:u8,s16le,s24le3,s24le4lsb.-Fdeviceβ same as-fexcept that if the device is disconnected, the one given with the previous-for-Foption will be used π.-fdeviceβ add thissndio(7)audio device to devices used for playing and/or recording. Preceding per-device options (-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. If no-foption is used,sndiodwill usersnd/0,rsnd/1, ...,rsnd/3πΆ.-jflagβ controls whether program channels are joined or expanded if the number of channels requested by a program is not equal to the device number of channels. If the flag is off, client channels are routed to the corresponding device channel, possibly discarding channels not present in the device ποΈ. If the flag is on, then a single client channel may be sent on multiple device channels, or multiple client channels may be sent to a single device channel. For instance, this feature could be used for mono to stereo conversions π§β¨. The default is on.-Laddrβ specify a local network addresssndiodshould listen on;sndiodwill listen on TCP port11025+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-thensndiodwill 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. Fr fr, don't be reckless with this one.
-mmodeβ set the sub-device mode. Valid modes areplay,rec, andmon, corresponding to playback, recording and monitoring. A monitoring stream is a fake recording stream corresponding to the mix of all playback streams π. Multiple modes can be specified, separated by commas, but the same sub-device cannot be used for both recording and monitoring π«. The default isplay,rec(i.e. full-duplex).-Qportβ specify an alternate MIDI port to use. If it doesn't work, the one given with the last-Qor-qoptions will be used. For instance, this allows a USB MIDI controller to be replaced without the need to restart programs using it πΉπ«Ά.-qportβ expose the given MIDI port. This allows multiple programs to share the port. If no-qoption is used,sndiodwill usermidi/0,rmidi/1, ...,rmidi/7πΌ.-rrateβ attempt to force the device to use this sample rate in Hertz. The default is48000β±οΈ.-snameβ add name to the list of sub-devices to expose. This allows clients to usesndiodinstead 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 thesndio(7)device name string β¨.-tmodeβ select the way clients are controlled by MIDI Machine Control (MMC) messages received bysndiod. If the mode isoff(the default), then programs are not affected by MMC messages π . If the mode isslave, 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 ποΈπ₯.-Uunitβ unit number. Eachsndiodserver instance has a unique unit number, used insndio(7)device names. The default is0π’.-vvolumeβ software volume attenuation of playback. The value must be between1and127, corresponding to-42dBand-0dBattenuation in 1/3dB steps π. Clients inherit this parameter. Reducing the volume in advance allows a client's volume to stay independent from the number of clients, as long as their number is small enough.18volume units (i.e.-6dBattenuation) allows the number of playback programs to be doubled π€―. The default is127.-wflagβ controlsndiodbehaviour 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 βοΈ. The default is off.-znframesβ the audio device block size in frames. This is the number of frames between audio clock ticks, i.e. the clock resolution β°. If a sub-device is created with the-toption, and MTC is used for synchronization, the clock resolution must be96,100or120ticks per second for maximum accuracy. For instance,100ticks per second at48000Hzcorresponds to a480frame block size. The default is480, or half of the buffer size (-b), if the buffer size is set.
Okay so ordering matters, bestie, pay attention π. On the command line, per-device parameters (-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. It's giving β¨sequenceβ¨.
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 sndiod is rsnd/0, and the default sub-device exposed by sndiod is snd/default π.
If sndiod is sent SIGINT or SIGTERM, it terminates π. If sndiod is sent SIGHUP, it reopens all audio devices and MIDI ports π.
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 -t option, 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 π― β which is literally the whole point, iykyk.
πΉ MIDI CONTROL πΉ
ok so here's where it gets iconic β sndiod spins up a MIDI port with the exact same name as the exposed audio sub-device, and MIDI programs can justβ¦ connect to it. It exposes the audio device clock and lets you control audio device properties straight through MIDI. no cap. π
A MIDI channel gets assigned to each stream, and the volume is changed using the standard volume controller (number 7). And like, the reverse too: when the audio client changes its own volume, that same MIDI controller message gets sent out. Which is lowkey perfect for monitoring, or as feedback for motorized faders. motorized faders are so main character, honestly. ποΈβ¨
The master volume can be changed using the standard master volume system exclusive message.
Streams created with the -t option are controlled by these MMC messages:
relocateβ audio sndiod clients just ignore this one π but the given time position gets sent to MIDI ports as an MTC "full frame" message, which forces all MTC-slaves to relocate to that position (more on that below).startβ puts all streams in starting mode. In this modesndiodwaits for every stream to become ready to start, and then starts them synchronously. Once started, new streams can still be created (sndiod) but they'll be blocked until the next stop-to-start transition. patience, bestie β³stopβ puts all streams in stopped mode (this is the default). In this mode, any stream trying to start playback or recording gets paused. Client streams that already started aren't affected until they stop and then try to start again.
Streams created with the -t option export the sndiod device clock using MTC, so non-audio software or hardware can be synchronized to the audio stream. Maximum accuracy hits when the number of blocks per second equals one of the standard MTC clock rates (96, 100 and 120Hz). These sample rates (-r) and block sizes (-z) are the recommended ones:
- 44100Hz, 441 frames (MTC rate is 100Hz)
- 48000Hz, 400 frames (MTC rate is 120Hz)
- 48000Hz, 480 frames (MTC rate is 100Hz)
- 48000Hz, 500 frames (MTC rate is 96Hz)
For instance, this command creates two devices: the default snd/default and a MIDI-controlled snd/mmc:
$ sndiod -r 48000 -z 400 -s default -t slave -s mmc
Streams connected to snd/default behave normally, while streams connected to snd/mmc wait for the MMC start signal and then start synchronously. And regardless of which device a stream is connected to, its playback volume knob is exposed. every stream gets its moment β¨
π HOT PLUGGING π
If devices specified with -F are unavailable when they're needed, or get unplugged at runtime, sndiod will attempt to seamlessly fall back to the last device specified. bye bestie, we'll manage π«Ά
But heads up: sndiod will not automatically switch to a specified device that gets plugged in at runtime. Instead, sndioctl(1) must be used to change the server.device control. you gotta ask, it's not gonna read your mind π
For instance, specifying a USB device with -F following a PCI device with -f lets sndiod use the USB one preferably when it's connected, and fall back to the PCI one when it's disconnected. iconic failover behaviour, honestly. π¦
πΈ EXAMPLES πΈ
Start the server using default parameters, creating an additional sub-device for output to channels 2:3 only (that's the rear speakers on most cards), exposing the snd/default and snd/rear devices:
$ sndiod -s default -c 2:3 -s rear
Start the server creating the default sub-device with low volume and an additional sub-device for high volume output, exposing the snd/default and snd/max devices:
$ sndiod -v 65 -s default -v 127 -s max
Start the server configuring the audio device to use a 48kHz sample frequency, 240-frame block size, and 2-block buffers. The corresponding latency is 10ms, which is the time it takes the sound to propagate 3.5 meters. physics said slay π
$ sndiod -r 48000 -b 480 -z 240
π SEE ALSO π
π BUGS π
Resampling is low quality; down-sampling especially should be avoided when recording. not the vibe, fr fr.
If -a off is used, sndiod creates sub-devices to expose first and then opens the audio hardware on demand. Technically, this allows sndiod to attempt to use one of the sub-devices it exposes as an audio device, creating a deadlock. And there's nothing to prevent the user from shooting themselves in the foot by creating such a deadlock. π we warned you, bestie.
ok that's the whole page, you're officially a sndiod girlie now π this Debian build ships with the $Mdocdate$ version stamp, and yeah the date is literally a placeholder β very mysterious of it. go forth and serve audio, periodt. ππ
π¦ where this page comes from
- alpine 3.24: sndio-doc 1.10.0-r4 Β· ISC
- arch rolling: sndio 1.10.0-1 Β· ISC
- debian trixie: sndiod 1.10.0-0.1 Β· ISC
- nixos 26.05: sndio 1.10.0
- nixpkgs unstable: sndio 1.10.0
- opensuse-leap 16.0: sndio 1.10.0-bp160.1.7 Β· ISC
- opensuse-leap 16.0: sndio 1.10.0-bp160.1.7 Β· ISC
- opensuse-leap 16.0: sndio 1.10.0-bp160.1.7 Β· ISC
- opensuse-leap 16.0: sndio 1.10.0-bp160.1.7 Β· ISC
- ubuntu resolute: sndiod 1.10.0-0.2 Β· ISC
- ubuntu stonking: sndiod 1.10.0-0.2 Β· ISC
- Copyright (c) 2006-2012 Alexandre Ratchov <alex@caoua.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms