To communicate with MAX9814 microphone amplifier, we're going to need an ADC input to sample the audio and a GPIO output to set the gain.
This tutorial assumes that you're familiar with basic architecture of the USB protocol, like descriptors, host requests and packet structure. Initially I wanted to make this on a blue pill board but the chip shortage didn't let me to. This tutorial should work even for STM32F0 family, so don't worry if you don't have the board that I've used. So here I'll try to explain how to implement USB microphone functionality on STM32F407 MCU using the STM USB Audio class library. I did not find any tutorials on sending audio data to PC, there were only basic 'USB speaker' projects that relied on the STM32CubeMX generating all descriptors, handlers etc and didn't really explain how to modify the program for other needs. I made this project because I needed a convenient way to capture and process a DC - 10kHz signal, and I just used the microphone to test how it would sound like. This is a simple project to capture oversampled ADC data and send it to PC as audio data via USB.