Skip to content

USB Control Protocol

Yihui Xiong edited this page Jun 13, 2018 · 1 revision

With the USB 4 mic array, we can tune some parameters of its audio processing algorithms or get the Direction Of Arrival (DOA). These data exchanges are done through a USB Vendor Specific Class Interface. The interface can be accessed through USB Control Transfer.

On Linux, we can run lsusb -v -d 2886: to find the interface:

Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              9 SEEED Control

The control command is sent by pyusb's usb.core.Device.ctrl_transfer(), its parameters are like:

ctrl_transfer(
        usb.util.CTRL_OUT | usb.util.CTRL_TYPE_VENDOR | usb.util.CTRL_RECIPIENT_DEVICE,
        0,
        command,
        id,
        data,
        TIMEOUT)

We only need to care about id, command and data:

bit 7 6 5-0
command 1:read, 0:write 1: int, 0:float cmd
name id cmd type max min r/w note
AECFREEZEONOFF 18 7 int 1 0 rw Adaptive Echo Canceler updates inhibit, 0 = Adaptation enabled, 1 = Freeze adaptation, filter only
AECNORM 18 19 float 16 0.25 rw Limit on norm of AEC filter coefficients
AECPATHCHANGE 18 25 int 1 0 ro AEC Path Change Detection, 0 = false (no path change detected), 1 = true (path change detected)
RT60 18 26 float 0.9 0.25 ro Current RT60 estimate in seconds
HPFONOFF 18 27 int 3 0 rw High-pass Filter on microphone signals, 0 = OFF, 1 = ON - 70 Hz cut-off, 2 = ON - 125 Hz cut-off, 3 = ON - 180 Hz cut-off
RT60ONOFF 18 28 int 1 0 rw RT60 Estimation for AES. 0 = OFF 1 = ON
AECSILENCELEVEL 18 30 float 1 1e-09 rw Threshold for signal detection in AEC [-inf .. 0] dBov (Default: -80dBov = 10log10(1x10-8))
AECSILENCEMODE 18 31 int 1 0 ro AEC far-end silence detection status, 0 = false (signal detected) , 1 = true (silence detected)
AGCONOFF 19 0 int 1 0 rw Automatic Gain Control, 0 = OFF , 1 = ON
AGCMAXGAIN 19 1 float 1000 1 rw Maximum AGC gain factor, [0 .. 60] dB (default 30dB = 20log10(31.6))
AGCDESIREDLEVEL 19 2 float 0.99 1e-08 rw Target power level of the output signal, [−inf .. 0] dBov (default: −23dBov = 10log10(0.005))
AGCGAIN 19 3 float 1000 1 rw Current AGC gain factor, [0 .. 60] dB (default: 0.0dB = 20log10(1.0))
AGCTIME 19 4 float 1 0.1 rw Ramps-up / down time-constant in seconds.
CNIONOFF 19 5 int 1 0 rw Comfort Noise Insertion, 0 = OFF, 1 = ON
FREEZEONOFF 19 6 int 1 0 rw Adaptive beamformer updates, 0 = Adaptation enabled, 1 = Freeze adaptation, filter only
STATNOISEONOFF 19 8 int 1 0 rw Stationary noise suppression, 0 = OFF, 1 = ON
GAMMA_NS 19 9 float 3 0 rw Over-subtraction factor of stationary noise. min .. max attenuation
MIN_NS 19 10 float 1 0 rw Gain-floor for stationary noise suppression, [−inf .. 0] dB (default: −16dB = 20log10(0.15))
NONSTATNOISEONOFF 19 11 int 1 0 rw Non-stationary noise suppression, 0 = OFF, 1 = ON
GAMMA_NN 19 12 float 3 0 rw Over-subtraction factor of non- stationary noise. min .. max attenuation
MIN_NN 19 13 float 1 0 rw Gain-floor for non-stationary noise suppression, [−inf .. 0] dB (default: −10dB = 20log10(0.3))
ECHOONOFF 19 14 int 1 0 rw Echo suppression, 0 = OFF, 1 = ON
GAMMA_E 19 15 float 3 0 rw Over-subtraction factor of echo (direct and early components). min .. max attenuation
GAMMA_ETAIL 19 16 float 3 0 rw Over-subtraction factor of echo (tail components). min .. max attenuation
GAMMA_ENL 19 17 float 5 0 rw Over-subtraction factor of non-linear echo. min .. max attenuation
NLATTENONOFF 19 18 int 1 0 rw Non-Linear echo attenuation, 0 = OFF, 1 = ON
NLAEC_MODE 19 20 int 2 0 rw Non-Linear AEC training mode, 0 = OFF, 1 = ON - phase 1, 2 = ON - phase 2
SPEECHDETECTED 19 22 int 1 0 ro Speech detection status, 0 = false (no speech detected), 1 = true (speech detected)
FSBUPDATED 19 23 int 1 0 ro FSB Update Decision, 0 = false (FSB was not updated), 1 = true (FSB was updated)
FSBPATHCHANGE 19 24 int 1 0 ro FSB Path Change Detection, 0 = false (no path change detected), 1 = true (path change detected)
TRANSIENTONOFF 19 29 int 1 0 rw Transient echo suppression, 0 = OFF, 1 = ON
VOICEACTIVITY 19 32 int 1 0 ro VAD voice activity status, 0 = false (no voice activity), 1 = true (voice activity)
STATNOISEONOFF_SR 19 33 int 1 0 rw Stationary noise suppression for ASR, 0 = OFF, 1 = ON
NONSTATNOISEONOFF_SR 19 34 int 1 0 rw Non-stationary noise suppression for ASR, 0 = OFF, 1 = ON
GAMMA_NS_SR 19 35 float 3 0 rw Over-subtraction factor of stationary noise for ASR, [0.0 .. 3.0] (default: 1.0)
GAMMA_NN_SR 19 36 float 3 0 rw Over-subtraction factor of non-stationary noise for ASR, [0.0 .. 3.0] (default: 1.1)
MIN_NS_SR 19 37 float 1 0 rw Gain-floor for stationary noise suppression for ASR, [−inf .. 0] dB (default: −16dB = 20log10(0.15))
MIN_NN_SR 19 38 float 1 0 rw Gain-floor for non-stationary noise suppression for ASR, [−inf .. 0] dB (default: −10dB = 20log10(0.3))
GAMMAVAD_SR 19 39 float 1000 0 rw Set the threshold for voice activity detection, [−inf .. 60] dB (default: 3.5dB 20log10(1.5))
DOAANGLE 21 0 int 359 0 ro DOA angle. Current value. Orientation depends on build configuration.
Clone this wiki locally