USB Audio (UAC) 简介

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.zip
Why do you need USB Audio Class 2.pdf

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值