1 AUDIO(7D) Devices AUDIO(7D) 2 3 4 5 NAME 6 audio - common audio framework 7 8 DESCRIPTION 9 The audio driver provides common support routines for audio devices in 10 Solaris. 11 12 13 The audio framework supports multiple personalities, allowing for 14 devices to be accessed with different programming interfaces. 15 16 17 The audio framework also provides a number of facilities, such as 18 mixing of audio streams, and data format and sample rate conversion. 19 20 Overview 21 The audio framework provides a software mixing engine (audio mixer) for 22 all audio devices, allowing more than one process to play or record 23 audio at the same time. 24 25 Multi-Stream Codecs 26 The audio mixer supports multi-stream Codecs. These devices have DSP 27 engines that provide sample rate conversion, hardware mixing, and 28 other features. The use of such hardware features is opaque to 29 applications. 30 31 Backward Compatibility 32 It is not possible to disable the mixing function. Applications must 33 not assume that they have exclusive access to the audio device. 34 35 Audio Formats 36 Digital audio data represents a quantized approximation of an analog 37 audio signal waveform. In the simplest case, these quantized numbers 38 represent the amplitude of the input waveform at particular sampling 39 intervals. To achieve the best approximation of an input signal, the 40 highest possible sampling frequency and precision should be used. 41 However, increased accuracy comes at a cost of increased data storage 42 requirements. For instance, one minute of monaural audio recorded in u- 43 Law format (pronounced mew-law) at 8 KHz requires nearly 0.5 megabytes 44 of storage, while the standard Compact Disc audio format (stereo 16-bit 45 linear PCM data sampled at 44.1 KHz) requires approximately 10 46 megabytes per minute. 47 48 49 An audio data format is characterized in the audio driver by four 50 parameters: sample Rate, encoding, precision, and channels. Refer to 51 the device-specific manual pages for a list of the audio formats that 52 each device supports. In addition to the formats that the audio device 53 supports directly, other formats provide higher data compression. 54 Applications can convert audio data to and from these formats when 55 playing or recording. 56 57 Sample Rate 58 Sample rate is a number that represents the sampling frequency (in 59 samples per second) of the audio data. 60 61 62 The audio mixer always configures the hardware for the highest possible 63 sample rate for both play and record. This ensures that none of the 64 audio streams require compute-intensive low pass filtering. The result 65 is that high sample rate audio streams are not degraded by filtering. 66 67 68 Sample rate conversion can be a compute-intensive operation, depending 69 on the number of channels and a device's sample rate. For example, an 70 8KHz signal can be easily converted to 48KHz, requiring a low cost up 71 sampling by 6. However, converting from 44.1KHz to 48KHz is computer 72 intensive because it must be up sampled by 160 and then down sampled by 73 147. This is only done using integer multipliers. 74 75 76 Applications can greatly reduce the impact of sample rate conversion by 77 carefully picking the sample rate. Applications should always use the 78 highest sample rate the device supports. An application can also do its 79 own sample rate conversion (to take advantage of floating point and 80 accelerated instructions) or use small integers for up and down 81 sampling. 82 83 84 All modern audio devices run at 48 kHz or a multiple thereof, hence 85 just using 48 kHz can be a reasonable compromise if the application is 86 not prepared to select higher sample rates. 87 88 Encodings 89 An encoding parameter specifies the audiodata representation. u-Law 90 encoding corresponds to CCITT G.711, and is the standard for voice data 91 used by telephone companies in the United States, Canada, and Japan. A- 92 Law encoding is also part of CCITT G.711 and is the standard encoding 93 for telephony elsewhere in the world. A-Law and u-Law audio data are 94 sampled at a rate of 8000 samples per second with 12-bit precision, 95 with the data compressed to 8-bit samples. The resulting audio data 96 quality is equivalent to that of stan dard analog telephone service. 97 98 99 Linear Pulse Code Modulation (PCM) is an uncompressed, signed audio 100 format in which sample values are directly proportional to audio signal 101 voltages. Each sample is a 2's complement number that represents a 102 positive or negative amplitude. 103 104 Precision 105 Precision indicates the number of bits used to store each audio sample. 106 For instance, u-Law and A-Law data are stored with 8-bit precision. PCM 107 data can be stored at various precisions, though 16-bit is the most 108 common. 109 110 Channels 111 Multiple channels of audio can be interleaved at sample boundaries. A 112 sample frame consists of a single sample from each active channel. For 113 example, a sample frame of stereo 16-bit PCM data consists of 2 16-bit 114 samples, corresponding to the left and right channel data. The audio 115 mixer sets the hardware to the maximum number of channels supported. If 116 a mono signal is played or recorded, it is mixed on the first two 117 (usually the left and right) channel only. Silence is mixed on the 118 remaining channels. 119 120 Supported Formats 121 The audio mixer supports the following audio formats: 122 123 Encoding Precision Channels 124 Signed Linear PCM 32-bit Mono or Stereo 125 Signed Linear PCM 16-bit Mono or Stereo 126 Signed Linear PCM 8-bit Mono or Stereo 127 u-Law 8-bit Mono or Stereo 128 A-Law 8-bit Mono or Stereo 129 130 131 132 133 The audio mixer converts all audio streams to 24-bit Linear PCM before 134 mixing. After mixing, conversion is made to the best possible Codec 135 format. The conversion process is not compute intensive and audio 136 applications can choose the encoding format that best meets their 137 needs. 138 139 140 The mixer discards the low order 8 bits of 32-bit Signed Linear PCM in 141 order to perform mixing. (This is done to allow for possible overflows 142 to fit into 32-bits when mixing multiple streams together.) Hence, the 143 maximum effective precision is 24-bits. 144 145 FILES 146 /kernel/drv/amd64/audio 147 Device driver (x86) 148 149 150 /kernel/drv/sparcv9/audio 151 Device driver (SPARC) 152 153 154 /kernel/drv/audio.conf 155 Driver configuration file 156 157 158 ATTRIBUTES 159 See attributes(5) for a description of the following attributes: 160 161 162 163 164 +--------------------+-----------------+ 165 |ATTRIBUTE TYPE | ATTRIBUTE VALUE | 166 +--------------------+-----------------+ 167 |Architecture | SPARC, x86 | 168 +--------------------+-----------------+ 169 |Interface Stability | Uncommitted | 170 +--------------------+-----------------+ 171 172 SEE ALSO 173 ioctl(2), attributes(5), audio(7I), dsp(7I) 174 175 176 177 January 10, 2020 AUDIO(7D)