USB Audio (UAC) 简介

来源:互联网 发布:python yield 编辑:程序博客网 时间:2024/06/11 04:15

Induction

USB audio is very popular.
One of the reasons is that USB audio is part of the USB standard and as a consequence native mode drivers are available in all the popular OS (Win, OSX and Linux).
Connecting a USB audio device is a matter of plug&play.

USB audio is a flexible solution as any PC offers USB.
If you use a laptop this is probably the way to go if you want to improve on the on-board sound card.

The audio is routed to the USB.
This is a matter of choosing the USB audio device in your media player.
The on-board sound card is bypassed; in fact you don’t need a sound card at all.
The USB audio device is your (outboard) sound card.

Today the resolution of USB audio ranges from 16 bit/ 32 kHz to 32 bit/ 384 kHz.
A lot of DACs are still limited to 16 bit/ 48 kHz max.

The data transfer from the PC to the DAC can be done in adaptive or in asynchronous mode.
In adaptive mode the DAC adjust its timing to the rate the data is pouring in.
In asynchronous mode the DAC keeps its timing constant and controls the amount of data send by the PC. By design asynchronous mode eliminates input jitter.

USB Audio Class 1 standard (1998)

This standard allows for 24 bits/96 kHz max.
The standard itself doesn’t impose any limitation on sample rate.
Class 1 is tied to USB 1 Full Speed = 12 MHz

Every millisecond a package is send.
Maximum package size is 1024 bytes.
2 channel * 24 bit * 96000 Hz sample rate= 4608000 bits/s or 576 Byte/ms
This fits in the 1024 byte limit.
Any higher popular sample rate e.g. 176 kHz needs 1056 bytes so in excess of the maximum package size.

All operating systems (Win, OSX, and Linux) support USB Audio Class 1 natively.
This means you don’t need to install drivers, it is plug&play.
All support 2 channel audio with 24 bit words and 96 kHz sample rate

NOTE: Audio 1.0 SpecificationUSB 2.0 core Specification 之前完成,因此 Audio 1.0 Specification 没有高速模式(High Speed)这一概念。可以通过一些经验规则使得 Audio 1.0 兼容设备在特定的操作系统上实现高速模式。比如修改 isochronous endpoint descriptor 的 bInterval = 4。目前尚没有详尽的经验规则保证在所有的操作系统上都能正常工作在高速模式下。

USB Audio Class 2 standard (2009)

USB Audio Class 2 additionally supports 32 bit and all common sample rates > 96 kHz
Class 2 uses High Speed (480 MHz). This requires USB 2 or 3.
As the data rate of High Speed is 40 X Full speed, recording a 60 channel using 24 bits at 96 kHz (132 Mbit/s) is not a problem.
Using High Speed USB for playback there are no limits in resolution.
It is downwards compatible with class 1.

From mid-2010 on USB audio class 2 drivers are available in OSX 10.6.4 and Linux.
Both support sample rates up to 384 kHz.
Companies like Thesycon or Centrance have developed a USB Class 2 Audio driver for Windows.
This was necessary because Microsoft simply didn’t support UAC2.
In April 2017, an update of Win10 finally brought native mode drivers.
If you use older versions of Win, you still need a third party driver.

USB Speed

  • Superspeed - 10 Gbps USB data rate (USB 3.1)
  • Superspeed - 5 Gbps USB data rate (USB 3.0)
  • High Speed - 480 Mb/s with a data signalling tolerance of ± 500ppm (USB 2).
    This means every 125 µs a SOF packet arrives with a allowed deviation of ± 0.0625 µs..
  • Full Speed - 12 Mb/s with a data signalling tolerance of ±0.25% or 2,500ppm. (USB 1&2)
    This means every 1ms a SOF packet arrives with a allowed deviation of ± 500ns.
  • Low Speed - 1.5Mbits/s with a data signalling tolerance of ±1.5% or 15,000ppm (USB 1&2)

配置流程

以 Microphone, PCM 格式,mono, 同步传输为例

Mono Device

  • Device Descriptors
  • Configuration Descriptors
  • Microphone Interface Descriptors
    • Microphone AudioControl Interface Descriptors
      • Microphone Standard AC(AudioControl) Interface Descriptor
      • Microphone Class-Specific AC(AudioControl) Descriptor
      • Microphone Input Terminal ID4 Descriptor
      • Microphone Feature Unit ID5 Descriptor
      • Microphone Output Terminal ID6 Descriptor
    • Microphone AudioControl Endpoint Descriptors
    • Microphone AudioStreaming Interface Descriptors (Alt.Set.1)
      • Mono Microphone Standard AS(AudioStreaming) Interface Descriptor
      • Mono Microphone Class-specific AS(AudioStreaming) General Interface Descriptor
      • Mono Microphone Type I Format Type Descriptor
      • Mono Microphone Standard AS(AudioStreaming) Audio Data Endpoint Descriptor
      • Mono Microphone Class-specific Isochronous Audio Data Descriptor
  • String Descriptors

NOTE:
1. Windows 和 Linux 对音频事件的响应流程稍有不同,要做兼容性处理,Linux 和 Android 一样。
2. Windows 会对设备驱动记忆,更改配置后最好卸载驱动,让 Windows 重新识别设备。

参考资料

The Well-Tempered Computer (An introduction to computer audio) - USB
Audio Device Class Spec for Basic Audio Devices

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 对办公室的异性老师产生好感怎么办 上古卷轴5任务NPC老打我怎么办 1岁半宝宝走路内八字怎么办 最近几个月例假周期都25天怎么办 从pr导出的视频大小不一样怎么办 合作医疗收据丢了不给报销怎么办 沧州新生医院—老人腹胀了该怎么办 内痔疮术后一个月吃了点辣椒怎么办 肛周脓肿手术后大便干怎么办 月经半个月了还没干净怎么办 房东出租违建房不退房租怎么办 上海公租房住满5年后怎么办 监狱对死缓犯人延长转为无期怎么办 手机号码办理的宽带不想要了怎么办 朋友诈骗罪被关看守所了该怎么办 打架被拘留家里有孩子没人看怎么办 刑事拘留满37天给逮捕了怎么办 因打架被拘留十五天释放后会怎么办 犯罪人在拘留所生了小孩怎么办 我申请了进京证更换车辆怎么办 丈夫去世前想把财产留给妻子怎么办 假货中通代收货款发现是假货怎么办 注册志愿者时身份证被使用该怎么办 双眼皮贴贴的皮肤送了怎么办? 满60岁社保末满十五年怎么办 眼角膜少了一块怎么办应该吃什么 左右胸相差一个罩杯左右怎么办 穿一字肩的裙子没有无肩内衣怎么办 农业网柑橘被奄24小时怎么办 钱包被偷了小偷抓到了钱不认怎么办 快高考了很想学却没有动力怎么办? 孩子高三了学习状态不好怎么办 离婚时对方说把钱都花了怎么办 挂科太多学校不给毕业证怎么办 大专挂科太多学校让延期毕业怎么办 安卓手机老是收到垃圾短信怎么办 高铁站行李拉安检仪上应该怎么办 连壁金融立案了投资钱怎么办 联壁金融倒了投资人的钱怎么办 改签的高铁票错过了怎么办 高铁票错过了当天没别的车次怎么办