3

I am working on a project that I need to do some processing with the audio signals obtained from a USB microphone. It would be best to read the original sample readings from the USB port. However, I couldn't find anything very relevant. I am planning to use C/C++ to implement this program. Can anyone help me to start?

I saw a library named libusb but I am not entirely sure how to use this as a way to fetch the sound signals from the USB mic. Also, when I say "fetch", I mean I need to see the originally sampled data.

return 0
  • 4,226
  • 6
  • 47
  • 72
  • What type of device is your USB microphone? Typically these will be USB Audio Class which allows it to enumerate as an audio interface instead of a generic USB interface. Also, what platform are you working on? – Preston Jan 15 '14 at 15:14
  • @Preston I think mine is just a generic USB device (Blue Microphone Snowflake), you might have some other thoughts. I can work on both Linux and Windows depending on which one is easier to achieve what I do. – return 0 Jan 17 '14 at 01:39

1 Answers1

3

The Blue Snowflake Microphone will enumerate as a USB Audio device on both Windows and Linux, which means you don't need a driver and you shouldn't have to talk to it as a generic USB device. Instead you will want to interface with the device using the native audio APIs. This means you can open the device, setup your audio format settings and start capturing samples directly from the device.

On Windows have a look at the Core Audio APIs, once you have your devices opened you should be able to create an audio session to grab samples from the device using WASAPI.

For Linux you should have a look at ALSA, and while I haven't used it PulseAudio seems to be a popular audio API for modern Linux distributions.

Preston
  • 2,543
  • 1
  • 17
  • 26
  • I recently learned about a cross-platform wrapper [PortAudio](http://www.portaudio.com/) that I want to share to add to the Windows and Linux examples already in this answer. Would have edited but the suggested edit queue is full – Jasmine Hegman Sep 17 '22 at 01:25