How to get PCM data from microphone in C++ (os Win

2019-01-28 16:15发布

问题:

I need to capture PCM data from microphone in C++.

I'm a beginner.

How to do it?

回答1:

You can do this with the waveInOpen() and waveInStart() API functions. There's a sample project available here.



回答2:

Check out The Synthesis Toolkit. They have a class called RtAudio that works on multiple platforms including Windows, OS X, and Linux. Beyond just giving you the PCM data, there are options for generating your own data, processing the data, and saving it to a standard file format.



回答3:

It depends what you want to do with your data. If you just want to do capturing without any special processing then you would need some basic and easy to use libraries such as:

  • Media Control Interface
  • Waveform Audio

If your intention is to do some audio processing then you should probably take a look at:

  • DirectSound
  • OpenAL
  • DirectShow
  • Windows Core Audio
  • XAudio2


标签: c++ pcm