Skip to main content
AGhez
Associate III
February 15, 2023
Solved

USB audio type I IEEE_FLOAT descriptor

  • February 15, 2023
  • 15 replies
  • 5855 views

Hi all,

I am using a STM32H7 and I implemented a composite usb device (CDC + AUDIO recording) using IAD interface descriptor.

I can successfully configure the audio interface as type I PCM (I tested both 16 and 32 bit), but if I try to configure the audio as type I IEEE_FLOAT windows does not recognize the microphone (the device is still present in device manager under 'sound devices', but there is no input device under 'Audio inputs and outputs'.

I just changed the wFormatTag field of the descriptor, leaving the bSubFrameSize=4 and bBitResolution=32.

Have I to change something else?

Thank you in advance,

regards

Arianna

This topic has been closed for replies.
Best answer by mohamed.ayed

Hi @AGhez​ 

It seems that windows USB audio 1.0 drivers does not support IEE_FLOAT

https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/usb-audio-class-system-driver--usbaudio-sys-

you need to switch to audio 2.0 class it is noted in microsoft documentation that audio 2.0 driver support IEE_FLOAT

https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/usb-2-0-audio-drivers?source=recommendations

15 replies

mohamed.ayed
ST Employee
February 27, 2023

Hi , @AGhez​ 

I suggest to change the PID of device.

AGhez
AGhezAuthor
Associate III
February 27, 2023

Hi @mohamed.ayed​ ,

thank you for your reply, but I tried with no success!

Do you have any other suggestions?

thanks

mohamed.ayed
mohamed.ayedBest answer
ST Employee
February 28, 2023

Hi @AGhez​ 

It seems that windows USB audio 1.0 drivers does not support IEE_FLOAT

https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/usb-audio-class-system-driver--usbaudio-sys-

you need to switch to audio 2.0 class it is noted in microsoft documentation that audio 2.0 driver support IEE_FLOAT

https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/usb-2-0-audio-drivers?source=recommendations

Piranha
Principal III
March 1, 2023

> windows USB audio 1.0 drivers does not support IEE_FLOAT

The link you gave:

All Type I formats (except 8-bit signed PCM)

It took me a minute to find out...

https://www.usb.org/sites/default/files/frmts10.pdf

2.2.6 Supported Formats

The following paragraphs list all currently supported Type I Audio Data Formats.

2.2.6.3 IEEE_FLOAT Format

AGhez
AGhezAuthor
Associate III
March 1, 2023

Hi @mohamed.ayed​ ,

thank you for your reply! I read these articles but it wasn't so clear for me: "All Type I formats" for me means also IEEE_FLOAT, as it is reported in the USB AUDIO 1.0 specifications under the type I supported formats..

But since in the second article you linked the IEEE_FLOAT format is explicitly mentioned probably you are right.

Can you confirm me that there are not ST examples for USB AUDIO 2.0?

Thank you again,

regards

Arianna

mohamed.ayed
ST Employee
March 1, 2023

Hi @AGhez​ ,

actually ST USB lib support only audio class 1.0 but USBX (AzureRTTOS) middleware support both Audio 1.0 and audio 2.0 and we don't have an example audio 2.0 until now.

AGhez
AGhezAuthor
Associate III
March 13, 2023

Hi,

I got my device enumerated in USB Audio 2.0 (just enumerated, it is not really working), but I am experiencing the same issue: with format PCM the microphone appears between the recording devices, changing the format to FLOAT makes the microphone to not appear!

Any other clue?

Thank you,

regards

Arianna

AScha.3
Super User
March 13, 2023

why you insist on float ? this is very unusual for audio device, because standard is pcm or I2S in 16/24/32 bit (float not possible) ; these are the data formats, codecs use for audio in/out .

"If you feel a post has answered your question, please click ""Accept as Solution""."
AGhez
AGhezAuthor
Associate III
March 13, 2023

I need 32 bit AND exclusive access: WASAPI does not support exclusive access with PCM 32 bits, but only with 8 and 16 bits, or with float, so that's why I am struggling with float..

Piranha
Principal III
March 14, 2023

Sounds like you have misunderstood something. WASAPI exclusive mode supports those formats, which the particular hardware and driver supports, because it doesn't do any processing. That's the whole point of exclusive mode! On the other hand, the WASAPI shared mode does the mixing and resampling and therefore has to have some common format - a single precision float.

AGhez
AGhezAuthor
Associate III
March 15, 2023

Check these links:

c# - how to Naudio loopbackcapture Exclusive mode with PCM 8kHZ and 16bits per sample - Stack Overflow

WAVEFORMATEX (mmreg.h) - Win32 apps | Microsoft Learn : If wFormatTag = WAVE_FORMAT_PCM, then wBitsPerSample should be set to either 8 or 16. If wFormatTag = WAVE_FORMAT_IEEE_FLOAT, wBitsPerSample should be set to 32

I also tried and the StartRecording in exclusive mode of the WasapiCapture fails with PCM 32 bit, while it succeeds with PCM 16 bit.

Piranha
Principal III
March 17, 2023

As I said - WASAPI exclusive mode supports those formats, which the particular hardware and driver supports, because it doesn't do any processing. PCM 32-bit is rarely supported, because it just wastes bandwidth with no practical usefulness. Maybe the particular device is something like this, while other devices can be like this. As you can see, the Windows sound properties show the formats supported. In addition you can install AIMP and check/test all of the Windows audio interfaces and supported formats.

And read these:

https://learn.microsoft.com/en-us/windows/win32/coreaudio/device-formats

https://henquist.github.io/0.6.2/backend_wasapi.html