Devices audio(7D)
NAME
audio - common audio framework
DESCRIPTION
The audio driver provides common support routines for audio
devices in Solaris.The audio framework supports multiple personalities, allow-
ing for devices to be accessed with different programming interfaces.The audio framework also provides a number of facilities,
such as mixing of audio streams, and data format and sample
rate conversion. OverviewThe audio framework provides a software mixing engine (audio
mixer) for all audio devices, allowing more than one process
to play or record audio at the same time.
Multi-Stream Codecs
The audio mixer supports multi-stream Codecs. These devices
have DSP engines that provide sample rate conversion, hardware mixing, and other features. The use of such hardware features is opaque to applications. Backward CompatibilityIt is not possible to disable the mixing function. Applica-
tions must not assume that they have exclusive access to theaudio device.
Audio FormatsDigital audio data represents a quantized approximation of
an analog audio signal waveform. In the simplest case, these
quantized numbers represent the amplitude of the input waveform at particular sampling intervals. To achieve the best approximation of an input signal, the highest possible sampling frequency and precision should be used. However, increased accuracy comes at a cost of increased data storagerequirements. For instance, one minute of monaural audio
recorded in u-Law format (pronounced mew-law) at 8 KHz
requires nearly 0.5 megabytes of storage, while the standardCompact Disc audio format (stereo 16-bit linear PCM data
sampled at 44.1 KHz) requires approximately 10 megabytes per minute.An audio data format is characterized in the audio driver by
four parameters: sample Rate, encoding, precision, and chan-
nels. Refer to the device-specific manual pages for a list
SunOS 5.11 Last change: 3 Aug 2009 1
Devices audio(7D)
of the audio formats that each device supports. In addition
to the formats that the audio device supports directly,
other formats provide higher data compression. Applicationscan convert audio data to and from these formats when play-
ing or recording. Sample RateSample rate is a number that represents the sampling fre-
quency (in samples per second) of the audio data.
The audio mixer always configures the hardware for the
highest possible sample rate for both play and record. Thisensures that none of the audio streams require compute-
intensive low pass filtering. The result is that high samplerate audio streams are not degraded by filtering.
Sample rate conversion can be a compute-intensive operation,
dependingon the number of channels and a device's sample rate. For example, an 8KHz signal can be easily converted to48KHz, requiring a low cost up sampling by 6. However, con-
verting from 44.1KHz to 48KHz is computer intensive because it must be up sampled by 160 and then down sampled by 147. This is only done using integer multipliers. Applications can greatly reduce the impact of sample rateconversion by carefully picking the sample rate. Applica-
tions should always use the highest sample rate the device supports. An application can also do its own sample rate conversion (to take advantage of floating point and accelerated instructions) or use small integers for up and down sampling.All modern audio devices run at 48 kHz or a multiple
thereof, hence just using 48 kHz can be a reasonable compromise if the application is not prepared to select higher sample rates. EncodingsAn encoding parameter specifies the audiodata representa-
tion. u-Law encoding corresponds to CCITT G.711, and is the
standard for voice data used by telephone companies in theUnited States, Canada, and Japan. A-Law encoding is also
part of CCITT G.711 and is the standard encoding fortelephony elsewhere in the world. A-Law and u-Law audio data
are sampled at a rate of 8000 samples per second with 12-bit
precision, with the data compressed to 8-bit samples. The
resulting audio data quality is equivalent to that of stan
dard analog telephone service.SunOS 5.11 Last change: 3 Aug 2009 2
Devices audio(7D)
Linear Pulse Code Modulation (PCM) is an uncompressed,signed audio format in which sample values are directly pro-
portional to audio signal voltages. Each sample is a 2's
complement number that represents a positive or negative amplitude. Precision Precision indicates the number of bits used to store eachaudio sample. For instance, u-Law and A-Law data are stored
with 8-bit precision. PCM data can be stored at various pre-
cisions, though 16-bit is the most common.
ChannelsMultiple channels of audio can be interleaved at sample
boundaries. A sample frame consists of a single sample from each active channel. For example, a sample frame of stereo16-bit PCM data consists of 2 16-bit samples, corresponding
to the left and right channel data. The audio mixer sets the
hardware to the maximum number of channels supported. If a mono signal is played or recorded, it is mixed on the first two (usually the left and right) channel only. Silence is mixed on the remaining channels. Supported FormatsThe audio mixer supports the following audio formats:
Encoding Precision ChannelsSigned Linear PCM 32-bit Mono or Stereo
Signed Linear PCM 16-bit Mono or Stereo
Signed Linear PCM 8-bit Mono or Stereo
u-Law 8-bit Mono or Stereo
A-Law 8-bit Mono or Stereo
The audio mixer converts all audio streams to 24-bit Linear
PCM before mixing. After mixing, conversion is made to the best possible Codec format. The conversion process is notcompute intensive and audio applications can choose the
encoding format that best meets their needs.The mixer discards the low order 8 bits of 32-bit Signed
Linear PCM in order to perform mixing. (This is done toallow for possible overflows to fit into 32-bits when mixing
multiple streams together.) Hence, the maximum effectiveprecision is 24-bits.
FILES/kernel/drv/audio 32-bit kernel driver module
SunOS 5.11 Last change: 3 Aug 2009 3
Devices audio(7D)
/kernel/drv/amd64/audio 64-bit x86 kernel driver module
/kernel/drv/sparcv9/audio 64-bit SPARC kernel driver
module/kernel/drv/audio.conf audio configuration file
ATTRIBUTES
See attributes(5) for a description of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | SPARC, x86 ||_____________________________|_____________________________|
| Availability | driver/audio |
|_____________________________|_____________________________|
| Interface Stability | Uncommitted ||_____________________________|_____________________________|
SEE ALSO
ioctl(2), attributes(5), audio(7I), dsp(7I)
SunOS 5.11 Last change: 3 Aug 2009 4