2023-02-15 09:18 AM
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
Solved! Go to Solution.
2023-03-14 04:56 PM
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.
2023-03-15 02:03 AM
Check these links:
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.
2023-03-16 07:12 PM
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
2023-03-17 01:32 AM
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.
2023-03-17 05:49 AM
Check Piranha's 2nd link, Exclusive Mode, 2nd bullet:
It looks like the 32 bit might be the problem, as he said before.
2023-03-22 08:43 AM
> 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.
2023-03-22 10:37 AM
> 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:
Sorry if my English is not so clear, but you may be more polite instead of pretending that people are stupid
Regards
Arianna
2023-03-22 05:47 PM
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.