|AUCAT(1)||General Commands Manual||AUCAT(1)|
aucatis an audio utility which can simultaneously play and record any number of audio streams, possibly controlled through MIDI. A typical invocation of
aucatconsists in providing streams to play and record, and possibly the audio device to use.
sndiod daemon acts as an audio server.
Its functionality is identical to
aucat, except that
streams are created dynamically when clients connect to the server. Thus,
instead of actual streams (paths to plain files), templates for client
streams (sub-device names) must be provided. Multiple independent audio
devices are supported, each has its own list of streams and MIDI control
The options are as follows:
sndiodopens the audio device only when needed or keeps it open all the time. This applies to MIDI ports controlling the device as well. If the flag is on then the device 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 device, or the device to be disconnected. The default is off, except for the default device.
-z), if the block size is set.
sndiodlogs on stderr until it daemonizes.
-abwz) apply to this device. Streams (
-ios) and control MIDI ports (
-q) that are applied after will be attached to this device. Device mode and parameters are determined from streams attached to it.
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.
-q) and MIDI files (
-mmidi) can be attached to it. Exposed sub-devices by
sndiodbehave like software MIDI ports, allowing any MIDI-capable application to send MIDI messages to MIDI hardware or to another application in a uniform way.
-i) and one output (
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 logical devices having different properties (e.g. channel ranges). The given name corresponds to the “option” part of the sndio(7) device name string.
sndiodserver instance has an unique unit number, used in sndio(7) device names. The default is 0. The unit number must be set before any
sndiodbehaviour when the maximum volume of the hardware is reached and a new stream is connected. This happens only when stream volumes are not properly set using the
-voption. If the flag is on, then the master volume (corresponding to the mix of all playback streams) is automatically adjusted to avoid clipping. Using off makes sense when all streams are recorded or produced with properly lowered volumes. The default is on.
If a stream is created with the
option, the “ignore” action is disabled for any stream
connected to it to ensure proper synchronization.
-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.
On the command line, per-device parameters
-abwz) must precede the device definition
-fMn), and per-stream parameters
-Ccehjmrtvx) must precede the stream definition
-ios). MIDI ports (
stream definitions (
-ios) must follow the definition
of the device (
-fMn) to which they are attached.
If no audio devices (
-fMn) are specified,
settings are applied as if the default device is specified. If no
sndiod sub-devices (
specified for a device, a default server sub-device is created attached to
it. If a device (
-fMn) is defined twice, both
definitions are merged: parameters of the first one are used but streams
-ios) and MIDI control ports
-q) of both definitions are created. The default
sndio(7) device used by
sndiod is rsnd/0, and the
default sub-device exposed by
SIGTERM, it terminates recording to files.
File formats are specified using the
option. The following file formats are supported:
Encodings are specified using the
option. The following encodings are supported:
sndiodcan be used to overcome hardware limitations and allow applications to run on fixed sample rate devices or on devices supporting only unusual encodings.
Certain applications, such as synthesis software, require a low latency audio setup. To reduce the probability of buffer underruns or overruns, especially on busy machines, the server can be started by the super-user, in which case it will run with higher priority. Any user will still be able to connect to it, but for privacy reasons only one user may have connections to it at a given time.
aucatcan expose the audio device clock on registered MIDI ports (
-q) and allows audio device properties to be controlled through MIDI. Additionally,
sndiodcreates a MIDI port with the same name as the exposed audio sub-device to which MIDI programs can connect.
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.
Streams created with the
-t option 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).
aucatwaits 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.
aucat) are stopped and rewound back to the starting position, while client streams (
sndiod) that are already started are not affected until they stop and try to start again.
Streams created with the
-t option export
sndiod device 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:
For instance, the following command will create two devices: the default snd/0 and a MIDI-controlled snd/0.mmc:
$ sndiod -r 48000 -z 400 -s default -t slave -s mmc
Streams connected to snd/0 behave normally, while streams connected to snd/0.mmc wait for the MMC start signal and start synchronously. Regardless of which device a stream is connected to, its playback volume knob is exposed.
For instance, the following command will play a file on the snd/0.mmc audio device, and give full control to MIDI software or hardware connected to the snd/0.thru MIDI port:
$ aucat -f snd/0.mmc -t slave -q midithru/0 -i file.wav
At this stage,
aucat will start, stop and
relocate automatically following all user actions in the MIDI sequencer.
Note that the sequencer must use snd/0 as the MTC
source, i.e. the audio server, not the audio player.
$ aucat -r 48000 -i file1.raw -r 44100 -i file2.raw
Record channels 2 and 3 into one stereo file and channels 6 and 7 into another stereo file using a 96kHz sampling rate for both:
$ aucat -j off -r 96000 -C 2:3 -o file1.raw -C 6:7 -o file2.raw
Split a stereo file into two mono files:
$ aucat -n -j off -i stereo.wav -C 0:0 -o left.wav -C 1:1 \ -o right.wav
Start server using default parameters, creating an additional sub-device for output to channels 2:3 only (rear speakers on most cards), exposing the snd/0 and snd/0.rear devices:
$ sndiod -s default -c 2:3 -s rear
Start server creating the default sub-device with low volume and an additional sub-device for high volume output, exposing the snd/0 and snd/0.max devices:
$ sndiod -v 65 -s default -v 127 -s max
Start 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.
$ sndiod -r 48000 -b 480 -z 240
aucatutility assumes non-blocking I/O for input and output streams. It will not work reliably on files that may block (ordinary files block, pipes don't). To avoid audio underruns/overruns or MIDI jitter caused by file I/O, it's recommended to use two processes: a
sndiodserver handling audio and MIDI I/O and a
aucatclient handling disk I/O.
Resampling is low quality; down-sampling especially should be avoided when recording.
Processing is done using 16-bit arithmetic, thus samples with more than 16 bits are rounded. 16 bits (i.e. 97dB dynamic) are largely enough for most applications though.
-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. To avoid this,
-a off is disabled for the
default audio device, but nothing prevents the user from shooting himself in
the foot by creating a similar deadlock.
The ability to merge multiple inputs is provided to allow multiple applications producing MIDI data to keep their connection open while idling; it does not replace a fully featured MIDI merger.
|February 9, 2012||OpenBSD-5.1|