pcm音频的格式类型
【文章内容属于多方转载内容】
PCM Parameters
PCM audio is coded using a combination of various parameters.
Resolution/Sample Size
This parameter specifies the amount of data used to represent each discrete amplitude sample. The most common values are 8 bits (1 byte), which gives a range of 256 amplitude steps, or 16 bits (2 bytes), which gives a range of 65536 amplitude steps. Other sizes, such as 12, 20, and 24 bits, are occasionally seen. Some king-sized formats even opt for 32 and 64 bits per sample.
Byte Order
When more than one byte is used to represent a PCM sample, the byte order (big endian vs. little endian) must be known. Due to the widespread use of little-endian Intel CPUs, little-endian PCM tends to be the most common byte orientation.
Sign
It is not enough to know that a PCM sample is, for example, 8 bits wide. Whether the sample is signed or unsigned is needed to understand the range. If the sample is unsigned, the sample range is 0..255 with a centerpoint of 128. If the sample is signed, the sample range is -128..127 with a centerpoint of 0. If a PCM type is signed, the sign encoding is almost always 2's complement. In very rare cases, signed PCM audio is represented as a series of sign/magnitude coded numbers.
Channels And Interleaving
If the PCM type is monaural, each sample will belong to that one channel. If there is more than one channel, the channels will almost always be interleaved: Left sample, right sample, left, right, etc., in the case of stereo interleaved data. In some rare cases, usually when optimized for special playback hardware, chunks of audio destined for different channels will not be interleaved.
Frequency And Sample Rate
This parameter measures how many samples/channel are played each second. Frequency is measured in samples/second (Hz). Common frequency values include 8000, 11025, 16000, 22050, 32000, 44100, and 48000 Hz.
Integer Or Floating Point
Most PCM formats encode samples using integers. However, some applications which demand higher precision will store and process PCM samples using floating point numbers.
Floating-point PCM samples (32- or 64-bit in size) are zero-centred and varies in the interval [-1.0, 1.0], thus signed values.
PCM Types
Linear PCM
The most common PCM type.
Logarithmic PCM
Rather than representing sample amplitudes on a linear scale as linear PCM coding does, logarithmic PCM coding plots the amplitudes on a logarithmic scale. Log PCM is more often used in telephony and communications applications than in entertainment multimedia applications.
There are two major variants of log PCM: mu-law (u-law) and A-law. Mu-law coding uses the format number 0x07 in Microsoft multimedia files (WAV/AVI/ASF) and the fourcc 'ulaw' in Apple Quicktime files. A-law coding uses the format number 0x06 is Microsoft multimedia files and the fourcc 'alaw' in Apple Quicktime files.
Every byte of a log PCM data chunk maps to a signed 16-bit linear PCM sample. [TODO: Add either the conversion tables or conversion formulas]
Differential PCM
Values are encoded as differences between the current and the previous value. This reduces the number of bits required per audio sample by about 25% compared to PCM.
Adaptive DPCM
The size of the quantization step is varied to allow further reduction of the required bandwidth for a given signal-to-noise ratio.
Platform-Specific PCM Identifiers And Characteristics
This section describes how different computing platforms store PCM audio data and any format identifiers they use.
DOS/Windows
The first widely available, PC audio card that could play back PCM audio was the Creative Labs' Sound Blaster. This drove the audio format for a lot of early audio-capable DOS applications and games. The original Sound Blaster could only play mono, unsigned 8-bit PCM data. Later Sound Blaster cards were capable of playing back 16-bit audio data. However, while these cards still played unsigned 8-bit PCM data, 16-bit data needed be signed.
Likely owing to the DOS/Intel little endian architecture, 16-bit PCM for the Sound Blaster also needs to be little endian.
Further, the original Sound Blaster was somewhat limited in the frequencies that it could support. The digital to analog conversion hardware (DAC) had to be programmed with a byte value (frequency divisor) that was processed through the following formula to yield the final playback frequency:
frequency = 1000000 / (256 - frequency_divisor)
A common divisor is 211 which yields an integer frequency of 22222 Hz, a common rate in the days of the Sound Blaster. Note that while very low frequencies (all the way down to 3921 Hz) were supported, frequencies above 45454 Hz were not.
Microsoft WAV/AVI/ASF Identifiers
Microsoft multimedia file formats such as WAV, AVI, and ASF all share the WAVEFORMATEX data structure. The structure defines, among other properties, a 16-bit little endian audio identifier. The following audio identifiers correspond to various PCM formats:
- 0x0001 denotes linear PCM
- 0x0006 denotes A-law logarithmic PCM
- 0x0007 denotes mu-law logarithmic PCM
Apple Macintosh
Native sample rates of early Apple Macintosh audio hardware included 11127 Hz and 22254 Hz. These sample rates are commonly seen in early QuickTime files.
Apple QuickTime Identifiers
Audio information in QuickTime files is stored along with an stsd atom that contains a FOURCC to indicate the format type. Apple QuickTime accomodates a number of different PCM formats:
- 'raw ' (need space character, ASCII 0x20, to round out FOURCC) denotes unsigned, linear PCM. 16-bit data is stored in little endian format.
- 'twos' denotes signed (i.e. twos-complement) linear PCM. 16-bit data is stored in big endian format.
- 'sowt' ('twos' spelled backwards) also denotes signed linear PCM. However, 16-bit data is stored in little endian format.
- 'in24' denotes 24-bit, big endian, linear PCM.
- 'in32' denotes 32-bit, big endian, linear PCM.
- 'fl32' denotes 32-bit floating point PCM. (Presumably IEEE 32-bit; byte order?)
- 'fl64' denotes 64-bit floating point PCM. (Presumably IEEE 64-bit; byte order?)
- 'alaw' denotes A-law logarithmic PCM.
- 'ulaw' denotes mu-law logarithmic PCM.
Red Book CD Audio
The "Red Book" defines the format of a standard audio compact disc (CD). The audio data on a standard CD consists of 16-bit linear PCM samples stored in little endian format, replayed at 44100 Hz (hence the standard term "CD-quality audio"), with left-right stereo interleaving.
Sega CD
Games made for the Sega CD, an add-on for the Sega Genesis game console, all seem to use sign-magnitude coding to store PCM information. It is a good guess that the Sega CD unit has custom hardware to play this format natively.
Sega Saturn
Games made for the Sega Saturn video game console generally seem to store PCM data as signed, 8-bit data or signed, big endian, 16-bit data. The curious property of the PCM, however, is the stereo handling. Generally, multimedia files on Sega Saturn games (most often stored using the Sega FILM format) would store a block of left channel information followed by a block of right channel information rather than interleaving left and right samples. This is likely due to custom multi-channel audio hardware in which individual channels are assigned pan positions. For playing stereo data, one channel is assigned extreme left and another is assigned extreme right. The correct samples are sent to their respective channels. Interleaved data would require deinterleaving before playback.
DVD PCM
Standard Video-DVDs can contain 16-bit, 20-bit and 24-bit signed, linear PCM (often called LPCM) streams. A stream can consist of up to 8 channels as long as the maximum bandwidth of 6.144 mbit/sec for any LPCM audio stream is not exceeded. Two samplerates are supported: 48kHz and 96kHz.
原文地址:https://www.cnblogs.com/8335IT/p/11423261.html
- 《SpringMVC从入门到放肆》一、概述
- 美团点评SQL优化工具SQLAdvisor开源
- 美团外卖前端可视化界面组装平台 —— 乐高
- Android自定义Lint实践2——改进原生Detector
- 布局编码的未来
- 美团点评前端无痕埋点实践
- Android远程调试的探索与实现
- Redux从设计到源码
- Golang语言社区--Golang通用连接池
- 学习笔记CB009:人工神经网络模型、手写数字识别、多层卷积网络、词向量、word2vec
- 本周群问题分享
- 干货 | 一篇文章教你用TensorFlow写名著
- 开发图片预加载框架
- 机器学习之分类问题实战(基于UCI Bank Marketing Dataset)
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- C语言发展史的点点滴滴
- 我写了一个R包,简化芯片的差异分析
- 【收藏】万字解析Scipy的使用技巧!
- Python 如何使用 HttpRunner 做接口自动化测试
- Python 爬虫时,高版本 App 如何进行抓包?
- 使用 shell-operator 实现 Operator
- 我们是如何用 K8S 搞定1000个应用的测试环境
- 关于Python 3.9,那些你不知道的事
- urllib, urllib2, urllib3 都是小弟弟
- 使用 Kustomize 定制 Helm Chart
- 装逼篇 | 抖音超火的九宫格视频是如何生成的,Python 告诉你答案
- 最全总结 | 聊聊 Python 数据处理全家桶(Mysql 篇)
- 6个提升效率的pandas小技巧
- 如何用 Python 让微博热搜榜动起来
- 如何用 Python 让微博热搜榜动起来