cancel
Showing results for 
Search instead for 
Did you mean: 

USB audio type I IEEE_FLOAT descriptor

AGhez
Associate III

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

17 REPLIES 17
Piranha
Chief II

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
Associate III

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
Chief II

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

AGhez
Associate III

My device supports only 2 channels, 32 bit, 48000 Hz and cannot be open in exclusive mode by wasapi.

Explain me why, if you can.

LCE
Principal

Check Piranha's 2nd link, Exclusive Mode, 2nd bullet:

It looks like the 32 bit might be the problem, as he said before.

Piranha
Chief II

> It looks like the 32 bit might be the problem, as he said before.

I didn't say that and the article also doesn't say it. The OS has no problems with 32-bit audio interfaces.

> fails with PCM 32 bit, while it succeeds with PCM 16 bit

> My device supports only ..., 32 bit

You are contradicting yourself...

> WasapiCapture fails

It doesn't matter at what some particular software fails. I already told how to check and test the capabilities with a reliable well known free software - use Windows sound properties and AIMP.

AGhez
Associate III

> I didn't say that and the article also doesn't say it.

I am glad to know that you are so rude also with other people of the community

>> fails with PCM 32 bit, while it succeeds with PCM 16 bit

>> My device supports only ..., 32 bit

>You are contradicting yourself...

I can modify my code and recompile it with different parameters, you know

>> WasapiCapture fails

>It doesn't matter at what some particular software fails. I already told how to check and test the capabilities with a reliable well known free software - use Windows sound properties and AIMP

I already checked the capabilities of my device with Windows, that it is not the point.

I try to explain better what I am trying to do:

  • if I compile my code in order to appear as microphone working in PCM 16 bit, I can start a recording with WASAPI in exclusive mode setting it as PCM 16 bit as well;
  • if I compile my code in order to appear as microphone working in PCM 32 bit, I cannot start a recording with WASAPI in exclusive mode setting it as PCM 32 bit as well.

Sorry if my English is not so clear, but you may be more polite instead of pretending that people are stupid

Regards

Arianna

Piranha
Chief II

Why haven't you tested 24-bit sample size, which is the most appropriate for Hi-Fi devices?

It is not clear how are you testing the PC software side. Some 12 years old less known .NET library used in your own software is not an indicator of anything. Check the recording with Audacity or some professional software, for example, REAPER.

The same thing about the MCU side. Are you using the HAL/Cube broken bloatware and ST's unusable USB stack? Instead use a stack developed by competent people - TinyUSB.

Post edited to adhere community guidelines.