AnsweredAssumed Answered

USB Audio Microphone on Windows XP, 7, 8

Question asked by mah on Jul 7, 2014
Latest reply on Apr 7, 2017 by Andy Rochette
USB Microphone on Windows XP, 7, 8

Hello,
I'm working on a USB microphone, mono, 8kHz, 16bits linear PCM.
I use the STM32 USB FS library from STMicroelectronics and my microcontroller is a STM32F103.

To test USB communication, voice samples are stored into memory and I try to send it over USB.
The USB microphone is correctly detected on Windows XP, 7 and 8.
When I try to record it with Audacity, the voice signal is correct on Windows XP and Windows 8.
The point is that on Windows 7, the signal is amplified and saturated (Cf screenshot)

I think this issue comes from my descriptor but I have no clue about why voice samples are amplified only on Windows 7.

Here is my descriptor :
---------------------------
const u8 Mic_ConfigDescriptor[] =
 {
/* Configuration 1 */
0x09,                                 /* bLength */
USB_CONFIGURATION_DESCRIPTOR_TYPE,    /* bDescriptorType */
0x64,                                 /* wTotalLength = 100  bytes */
0x00,
0x02,                                 /* bNumInterfaces */
0x01,                                 /* bConfigurationValue */
0x00,                                 /* iConfiguration */
0x80,                                 /* bmAttributes  BUS Powred*/
0x32,                                 /* bMaxPower = 100 mA*/
/* 09 byte*/
/* Interface 0, Alternate Setting 0, USB Microphone Standard AC Interface Descriptor */
MICRO_SIZ_INTERFACE_DESC_SIZE,        /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
0x00,                                 /* bInterfaceNumber */
0x00,                                 /* bAlternateSetting */
0x00,                                 /* bNumEndpoints */
USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOCONTROL,          /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
0x00,                                 /* iInterface */
/* 09 byte*/
/* USB Microphone Class-specific AC Interface Descriptor */
MICRO_SIZ_INTERFACE_DESC_SIZE,        /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
AUDIO_CONTROL_HEADER,                 /* bDescriptorSubtype */
0x01,          /* 1.00 */             /* bcdADC */
0x00,
0x1E,                                 /* wTotalLength = 30*/
0x00,
0x01,                                 /* bInCollection */
0x01,                                 /* baInterfaceNr */
/* 09 byte*/
/* USB Microphone Input Terminal Descriptor */
AUDIO_INPUT_TERMINAL_DESC_SIZE,       /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
AUDIO_CONTROL_INPUT_TERMINAL,         /* bDescriptorSubtype */
0x01,                                 /* bTerminalID */
0x02,                                 /* wTerminalType: terminal is Micro = 0x0201 */
0x01,
0x00,                                 /* bAssocTerminal */
0x01,                                 /* bNrChannels */
0x00,                                 /* wChannelConfig 0x0000  Mono */
0x00,
0x00,                                 /* iChannelNames */
0x00,                                 /* iTerminal */
/* 12 byte*/
/* USB Microphone Output Terminal Descriptor*/
AUDIO_OUTPUT_TERMINAL_DESC_SIZE,      /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
AUDIO_CONTROL_OUTPUT_TERMINAL,        /* bDescriptorSubtype */
0x02,                                 /* bTerminalID */
0x01,                                 /* wTerminalType AUDIO_USB_STREAMING.  0x0101*/
0x01,
0x00,                                 /* bAssocTerminal */
0x01,                                 /* bSourceID */
0x00,                                 /* iTerminal */
/* 09 byte*/
/* Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith */
MICRO_SIZ_INTERFACE_DESC_SIZE,        /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
0x01,                                 /* bInterfaceNumber */
0x00,                                 /* bAlternateSetting */
0x00,                                 /* bNumEndpoints */
USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
0x00,                                 /* iInterface */
/* 09 byte*/
/* Interface 1, Alternate Setting 1, Audio Streaming - Operational */
MICRO_SIZ_INTERFACE_DESC_SIZE,        /* bLength */
USB_INTERFACE_DESCRIPTOR_TYPE,        /* bDescriptorType */
0x01,                                 /* bInterfaceNumber */
0x01,                                 /* bAlternateSetting */
0x01,                                 /* bNumEndpoints */
USB_DEVICE_CLASS_AUDIO,               /* bInterfaceClass */
AUDIO_SUBCLASS_AUDIOSTREAMING,        /* bInterfaceSubClass */
AUDIO_PROTOCOL_UNDEFINED,             /* bInterfaceProtocol */
0x00,                                 /* iInterface */
/* 09 byte*/
/* USB Microphone Class-specific AS General Interface Descriptor */
AUDIO_STREAMING_INTERFACE_DESC_SIZE,  /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
AUDIO_STREAMING_GENERAL,              /* bDescriptorSubtype */
0x02,                                 /* bTerminalLink */
0x01,                                 /* bDelay */
0x01,                                 /* wFormatTag (PCM)
0x00,
/* 07 byte*/
/* USB Microphone Type I Format Type Descriptor */
0x0B,                                 /* bLength */
AUDIO_INTERFACE_DESCRIPTOR_TYPE,      /* bDescriptorType */
AUDIO_STREAMING_FORMAT_TYPE,          /* bDescriptorSubtype */
AUDIO_FORMAT_TYPE_I,                  /* bFormatType */
0x01,                                 /* bNrChannels */
0x02,                                 /* bSubFrameSize */
16,                                    /* bBitResolution */ (16 bits resolution)
0x01,                                 /* bSamFreqType */
0x40,                                 /* tSamFreq 8kHz
0x1F,
0x00,
/* 11 byte*/
/* USB Microphone Standard Endpoint Descriptor */
AUDIO_STANDARD_ENDPOINT_DESC_SIZE,    /* bLength */
USB_ENDPOINT_DESCRIPTOR_TYPE,         /* bDescriptorType */
0x81,                                 /* bEndpointAddress 1 IN endpoint*/
USB_ENDPOINT_TYPE_ISOCHRONOUS,        /* bmAttributes */
0x10,                                 /* wMaxPacketSize (16 bytes (2bytes * 8samples))
0x00,
0x01,                                 /* bInterval */
0x00,                                 /* bRefresh */
0x00,                                 /* bSynchAddress */
/* 09 byte*/
/* USB Microphone Class-specific Isoc. Audio Data Endpoint Descriptor */
AUDIO_STREAMING_ENDPOINT_DESC_SIZE,   /* bLength */
AUDIO_ENDPOINT_DESCRIPTOR_TYPE,       /* bDescriptorType */
AUDIO_ENDPOINT_GENERAL,               /* bDescriptor */
0x00,                                 /* bmAttributes */
0x00,                                 /* bLockDelayUnits */
0x00,                                 /* wLockDelay */
0x00,
/* 07 byte*/
};
---------------------------

Have someone already encountered this type of problem ? Do you have an idea of how to solve this issue ?

Thanks

Outcomes