量化 Quantization
引言 Intro
用于表示模拟值的比特越多,表示就越精确。通常比特数按 递增
The more bits used to represent an analog value, the more precise the representation would be!
量化将可用幅度范围分成 个离散级。
Quantization divides the available amplitude range into 2^N discrete levels.
位深越大,数字化版本中幅度变化可以越细微,但文件大小也随位深增加而增加。
The larger the bit depth, the more subtle the amplitude changes can be in a digitized version, but the file size also increases as the bit depth increases.

量化步长(Δ)是相邻级之间的距离。
The quantization step size (Δ) is the distance between adjacent levels.
量化步长公式 Quantization step size
例如,假如是2-bit 量化,我们就能分出4个level

采样与量化的比较
量化误差 Quantization Error
量化误差公式
其中:
- 是原始采样值 original sampled value
- 是量化值 quantized value
- 是量化误差 quantization error
例如对于一个2-bit 量化器,实际模拟信号在某采样瞬间幅度为 0.40 V,它会被表示为 0.25 V。因此量化误差为 0.40 V – 0.25 V = 0.15 V
量化与信噪比 Quantization and SNR
信噪比是正确(纯)信号功率与量化过程添加噪声之比,以分贝(dB)测量。
The signal-to-noise ratio is the ratio of the power of the correct (pure) signal to the noise added by the quantization process, which measured in decibels (dB).
对于理想满量程正弦输入和均匀 N-bit 量化器,理论量化 SNR 约为 。
For an ideal full-scale sinusoidal input and a uniform N-bit quantizer, the theoretical quantization SNR is approximately .
动态范围 Dynamic Range
动态范围是在给定位深下可表示的音频信号最大幅度与最小幅度之比。
Dynamic range is the ratio between the largest amplitude and the smallest amplitude of the audio signal that can be represented with a given bit depth.
简单来说,就是最响亮与最轻柔部分(dB)之间的差值。
压缩 Compression
为什么需要压缩?
- 数字音频可能需要大量存储空间和传输带宽。Digital audio can require substantial storage space and transmission bandwidth.
- 更高采样率、更大位深和更多声道会增加数据需求。Higher sampling rates, greater bit depths, and more channels increase data requirements.
- 好处包括减少存储、降低带宽需求和更高效的流媒体。Benefits include reduced storage, lower bandwidth requirements, and more efficient streaming.
压缩方法:有损 lossy 和无损 lossless
未压缩音频格式 Uncompressed audio format
如果你需要以不危及音乐质量的方式分享音乐,使用未压缩音频格式。
if you need to share your music in a way that doesn’t jeopardize the quality of your music in any way, use an uncompressed audio format.
- 优点:录音室音频质量不受妥协。
PROS: Studio audio quality without compromise - 缺点:文件大,数字分享或邮件发送可能麻烦。
CONS: Large File Size that can be troublesome when trying to share digitally or via email
WAV 和 AIFF 将是你最好的朋友。(PS:😄)
WAV
WAV 文件可使用未压缩的脉冲编码调制(PCM) 存储音频,保留编码样本值而不会因压缩丢失信息。
High-quality audio: WAV files can store audio using uncompressed PCM, preserving the encoded sample values without compression-related information loss.
AIFF
常见 AIFF 文件使用可配置采样率和位深存储未压缩的 PCM 音频,不会因此压缩丢失信息。
Common AIFF files store uncompressed PCM audio using configurable sampling rates and bit depths without compression-related information loss.
比较:WAV和AIFF
当包含相同 PCM 音频数据且采样率和位深匹配时,WAV 和 AIFF 可提供相同音频质量。
WAV and AIFF can deliver identical audio quality when they contain the same PCM audio data with matching sample rates and bit depths.
WAV 广泛用于 Windows 工作流,而 AIFF 与 Apple 和 Mac 工作流有历史关联。
Platform preference: WAV is widely used in Windows-based workflows, while AIFF has historical associations with Apple and Mac-based workflows.
压缩音频格式 Compressed audio format
如果你的意图是轻松快速分享音乐,选择压缩音频格式以获得小文件。
if your intent is to make sharing your music easy and fast, choose a compressed audio format that will provide you with small file size.
- 优点:文件小,非常适合通过邮件、直接消息发送或存储在移动设备上。
PROS: Small file size, perfect for sending via email, direct messages, or storing on mobile devices - 缺点:为获得更小文件,音频质量被妥协;文件越小,音质越差。
CONS: To achieve smaller files, audio quality is compromised. The smaller the file, the worse the audio quality will be.
对于所有这些情况,选择压缩音频格式如 MP3 或 M4A。(PS:怎么不是最好的朋友了😄)
MP3 – 压缩且有损 Compressed and Lossy
MP3 通过丢弃感知上不太重要的选定音频信息来减小文件大小。
MP3 reduces file size by discarding selected audio information that is less perceptually important.
处理流程:
- 输入音频信号:PCM 音频样本。
Input Audio Signal; PCM audio samples - 滤波器组:将音频分成频率子带。
Filter Bank; Divides audio into frequency subbands - MDCT 变换:将子带样本转换为频率系数。
MDCT Transformation; Converts subband samples into frequency coefficients - 心理声学模型:确定感知上不太重要的音频信息。
Psychoacoustic Model; Determines perceptually less important audio information - 量化:降低音频系数精度。
Quantization; Reduces precision of audio coefficients - Huffman 编码:高效编码量化数据。
Huffman Encoding; Encodes quantized data efficiently - MP3 比特流:压缩后的 MP3 文件。
MP3 Bitstream; Compressed MP3 file
M4A – 压缩且有损 Compressed and Lossy
M4A 文件通常包含使用高级音频编码(AAC)编码的音频,这是一种有损压缩方法。
Audio encoding: M4A files commonly contain audio encoded using Advanced Audio Coding (AAC), a lossy compression method.
在可比比特率下,AAC 通常能提供比 MP3 更好的感知音频质量,尽管结果取决于编码器、比特率和音频内容。
AAC can often deliver better perceived audio quality than MP3 at comparable bitrates, although results depend on the encoder, bitrate, and audio content.
更小文件大小:有损 AAC 压缩减少存储和传输音频所需数据量。
Smaller file sizes: Lossy AAC compression reduces the amount of data needed to store and transmit audio.
MP3 仍有特别广泛的传统兼容性,而 M4A 支持取决于设备、软件和文件中包含的编解码器。
Limitations: MP3 still has particularly broad legacy compatibility, while M4A support depends on the device, software, and codec contained in the file.
FLAC – 无损压缩 Lossless compression
FLAC 减小音频文件大小,同时保留所有原始数字音频数据,允许比特完美重建。
FLAC reduces audio file size while preserving all original digital audio data, allowing bit-perfect reconstruction.
FLAC 精确保留原始编码音频样本,适合归档、高质量播放和音频分发。
FLAC preserves the original encoded audio samples exactly, making it suitable for archiving, high-quality playback, and audio distribution.