The audio framework supports multiple personalities, allowing 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.
An audio data format is characterized in the audio driver by four parameters: sample Rate, encoding, precision, and channels. Refer to the device-specific manual pages for a list 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. Applications can convert audio data to and from these formats when playing or recording.
The audio mixer always configures the hardware for the highest possible sample rate for both play and record. This ensures that none of the audio streams require compute-intensive low pass filtering. The result is that high sample rate audio streams are not degraded by filtering.
Sample rate conversion can be a compute-intensive operation, depending on the number of channels and a device's sample rate. For example, an 8KHz signal can be easily converted to 48KHz, requiring a low cost up sampling by 6. However, converting 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 rate conversion by carefully picking the sample rate. Applications 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.
Linear Pulse Code Modulation (PCM) is an uncompressed, signed audio format in which sample values are directly proportional to audio signal voltages. Each sample is a 2's complement number that represents a positive or negative amplitude.
Encoding Precision Channels Signed 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 not compute 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 to allow for possible overflows to fit into 32-bits when mixing multiple streams together.) Hence, the maximum effective precision is 24-bits.
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|
|January 10, 2020|