USB Audio Class (UAC) Audio Interpretation Specification

foreword

One of the reasons for the popularity of USB Audio is that USB Audio is part of the USB standard, so native mode drivers are available for all process operating systems (Win Linux Mac). USB audio is a flexible solution since any PC offers a USB interface.


提示:以下是本篇文章正文内容

一、USB Audio Class ?

USB Audio Class , USB audio class, a general data interface like USB, can have many ways to realize digital audio data transmission. Different developers can define any control method, transmission mode, audio format and other parameters according to their own preferences and needs.

USB is very suitable as a PC-based audio (including voice and music, etc.) transmission protocol, and the PC-based telephone system has been an important consideration and driving force for the development of the USB interface from the very beginning. On the other hand, the USB interface has a bandwidth much higher than audio requirements, and can transmit extremely high-quality (high sampling rate, high encoding rate, multi-channel) audio data. Therefore, audio functions such as telephony, music playback, recording, etc. can be easily implemented on the USB interface.

----- Excerpt from Baidu Encyclopedia

UAC is the abbreviation of USB Audio Class, and its application scenarios generally include devices such as conference treasures, earphones, and microphones. UAC is divided into UAC1.0 and UAC2.0. Due to UAC2.0, the compatibility on windows is not good. In the product, it will bring various pitfalls, so generally choose UAC1.0

二、USB Device Class Definition for Audio Devices

In theory, a common data interface like USB can have many ways to realize digital audio data transmission. Different developers can define any control method, transmission mode, audio format and other parameters according to their own preferences and needs. However, considering the market and industrial development, it is very necessary to define a high-quality and standardized audio transmission mechanism that is recognized by different developers. Only in this way is it possible to maintain maximum compatibility with the different audio devices that may be connected on the USB. A standardized transmission mechanism can also keep software drivers as general and concise as possible. The USB audio class (Audio Device Class) is defined to meet the above requirements. The USB audio class includes all audio streams and audio control functions compatible with the USB interface, even including the use of analog audio sources, and devices that use the USB interface as the control interface are also classified as USB audio devices.

----- Excerpt from Baidu Encyclopedia

So the UAC specification came into being. The introduction of the protocol can refer to the UAC specification (USB audio) , and the protocol should be read several times theoretically. In order to understand some of the relevant details. In the process of reading the agreement, you generally have to experience

  1. " What does this mean?" means that the current knowledge reserve is not enough, and many concepts cannot be understood in context, which requires supplementing some relevant basic and theoretical knowledge points.
  2. " Wow, that's how it is." There is a feeling of sudden enlightenment, which means that the relevant knowledge points have been grasped initially.
  3. " Damn, why does this problem still exist? " Obviously I have understood this knowledge point, so it should be no problem in theory. It means that some details have been overlooked in the practice process, and it is necessary to look at the details of some agreements to improve the previous understanding, so as to achieve mastery.
  4. " The problem is more important than the solution. " With the mastery of martial arts, one's own meridians can be opened up, and one can get started for further studies.

1. UAC rate

insert image description here
insert image description here

  • At present, UAC1.0 spec stipulates that a piece of data can be sent every 1ms, and a single piece of data under High speed is 1024Byte, so the maximum is (1024 x 8 x 1000) bit/s. In theory, UAC1.0 supports 2 ch
    * 32 bit * 96000 Hz rate = 6144000 = 6144000 bit/s or 768 Byte /ms which also fits the 1024 byte limit.

  • The UAC2.0 spec can send a piece of data every 125us. Under High speed, the standard is that a single piece of data is 1024Byte, so the maximum is (1024 x 8 x 1000 x 8) bit/s. The maximum situation: 3 pieces of data can be sent at a
    time , so it is (1024 x 8 x 1000 x 8 x 3) bit/s

2. Descriptors

For programmers who need to engage in USB development, being familiar with USB descriptors is the first and very important step. Through this article, you can have a clear understanding of descriptors. The various descriptors defined by USB have those functions

  • Each USB device has only one device descriptor, which mainly describes the device type, endpoint 0 maximum packet length, device version, configuration quantity, etc. to the host. How is the device descriptor described in the protocol?
//通过 UsbTreeView 工具查看一款带有UAC功能的音箱中的描述符 
  ---------------------- Device Descriptor ----------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x200 (USB Version 2.00)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x40 (64 bytes)
idVendor                 : 0x12D1 (Huawei Technologies Co., Ltd.)
idProduct                : 0x0206
bcdDevice                : 0x0100
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "bestechnic"
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "HUAWEI Sound Joy"
iSerialNumber            : 0x03 (String Descriptor 3)
 Language 0x0409         : "20160406.1"
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 00 02 00 00 00 40 D1 12 06 02 00 01 01 02   .......@........
                           03 01                                             ..
  • Each USB device has at least one or more configuration descriptors, but the host can only select a certain configuration at the same time. The standard configuration descriptor mainly describes the device attributes, required current, number of supported interfaces, etc. under the current configuration to the host. Configuration descriptor set length and so on.
    ------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x00E5 (229 bytes)
bNumInterfaces           : 0x04 (4 Interfaces)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x00 (No String Descriptor)
bmAttributes             : 0xA0
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x01 (yes)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x32 (100 mA)
Data (HexDump)           : 09 02 E5 00 04 01 00 A0 32 09 04 00 00 00 01 01   ........2.......
                           00 00 0A 24 01 00 01 52 00 02 01 02 0C 24 02 01   ...$...R.....$..
                           01 02 00 04 0F 00 00 00 11 24 06 02 01 02 03 00   .........$......
                           00 00 00 00 00 00 00 00 00 09 24 03 03 01 01 00   ..........$.....
                           02 00 0C 24 02 04 01 01 00 02 03 00 00 00 0D 24   ...$...........$
                           06 05 04 02 03 00 00 00 00 00 00 09 24 03 06 01   ............$...
                           03 00 05 00 09 04 01 00 00 01 02 00 00 09 04 01   ................
                           01 01 01 02 00 00 07 24 01 03 00 01 00 0B 24 02   .......$......$.
                           01 04 02 10 01 80 3E 00 09 05 83 0D 80 00 01 00   ......>.........
                           00 07 25 01 00 00 00 00 09 04 02 00 00 01 02 00   ..%.............
                           00 09 04 02 01 01 01 02 00 00 07 24 01 04 00 01   ...........$....
                           00 0B 24 02 01 02 02 10 01 80 BB 00 09 05 03 0D   ..$.............
                           C0 00 01 00 00 07 25 01 00 00 00 00 09 04 03 00   ......%.........
                           01 03 00 00 00 09 21 11 01 00 01 22 4B 00 07 05   ......!...."K...
                           84 03 03 00 04                                    .....
  • Each USB configuration has at least one or more interface descriptors. The interface descriptor mainly indicates the device type and the number of endpoints used under this interface (excluding endpoint 0). An interface is to implement a function. It may be enough for the function to require endpoint 0, and may also require other endpoints to cooperate
        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00
bAlternateSetting        : 0x00
bNumEndpoints            : 0x00 (Default Control Pipe only)
bInterfaceClass          : 0x01 (Audio)
bInterfaceSubClass       : 0x01 (Audio Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x00 (No String Descriptor)
Data (HexDump)           : 09 04 00 00 00 01 01 00 00                        .........

//TODO

Guess you like

Origin blog.csdn.net/z2066411585/article/details/126071060