AUDIOCTL(1)

NAME
audioctl - control software audio format

SYNOPSIS
audioctl [-n] [-d device] -a
audioctl [-n] [-d device] name ...
audioctl [-n] [-d device] -w name=value ...

DESCRIPTION
The audioctl command displays or sets the parameters that determine the playback and recording format for software using an audio device. It is most useful when the full audio(4) API is not available, e.g. when playing or recording raw audio data from a sh(1) script, or from the command line. It does not control the underlying hardware format, which can be changed with audiocfg(1).

The variables that can be inspected and changed with audioctl are normally per-application and are reset when a /dev/audioX device is opened. This can be circumvented by using /dev/soundX instead, which retains global state.

If a list of variables is present on the command line, then audioctl prints the current value of those variables for the specified device. If the -a flag is specified, all variables for the device are printed. If the -w flag is specified audioctl attempts to set the specified variables to the given values.

The -d flag can be used to give an alternative audio control device. The default can be set using the AUDIOCTLDEVICE variable in the environment, or set for the system using audiocfg(1), or if neither of those applies is /dev/audioctl0.

The -n flag suppresses printing of the variable name.

ENVIRONMENT

AUDIOCTLDEVICE
    the audio control device to use, unless overridden by -d.

FILES
/dev/audio
    a symlink indicating the default audio device
/dev/audio0
    state resetting audio I/O device (others: audio1, audio2, ...)
/dev/sound
    a symlink indicating the default sound device
/dev/sound0
    state retaining audio I/O device (also sound1, sound2, ...)
/dev/audioctl
    a symlink indicating the default audio control device
/dev/audioctl0
    audio control device (and audioctl1, audioctl2, ...)

The /dev/audioN, /dev/soundN, and /dev/audioctlN, devices with the same value of N refer to the same audio stream. Different values for N refer to different audio streams, which may use different parameters.

EXAMPLES
To set the playing sampling rate to 11025, you can use
    audioctl -w play.sample_rate=11025
To set all of the play parameters for CD-quality audio, you can use
    audioctl -w play=44100,2,16,slinear_le

COMPATIBILITY
The old -f flag is still supported. This support will be removed eventually.

SEE ALSO
audiocfg(1), audioplay(1), audiorecord(1), mixerctl(1), audio(4), sysctl(8)

HISTORY
The audioctl command first appeared in NetBSD 1.3.

CAVEATS
Since the parameters controlled by audioctl are global, they can be changed unexpectedly if another application uses the same audio device.

It is always preferable to use AUDIO_SETINFO on a per-process /dev/audioX device, if the audio(4) ioctls are available in the programming environment. Similarly, audioplay(1) and audiorecord(1) are more safe for use in scripting.