How to capture multiple channels of audio

Introduction of audio data storage format:

  1. ProCapture capture device can support up to 8 channels of audio data, each frame containing MWCAP_AUDIO_SAMPLES_PER_FRAME (192)times of sampling. The maximum sampling depth is 32bit (4 bytes);
  2. Each captured audio frame is stored in a sequence of left channel 0,1,2,3, and right channel 0,1,2,3;
  3. The audio data is stored in the order of high byte to low byte, in other words, the valid data is obtained from high byte firstly;

MWCapture SDK provides methods to capture multi-channel audio data:

MWOpenChannel() → MWGetAudioInputSourceArray() → MWStartAudioCapture() → MWRegisterNotify() → MWGetAudioSignalStatus() → MWCaptureAudioFrame()

  1. With SDK, execute MWGetAudioInputSourceArray() to get audio input source information. In this way, users can know what formats of audio signals there are, and how many audio formats each channel can obtain.
  2. Before video capture, it’s necessary to register event notification object, the notification mode mask should contain
    MWCAP_NOTIFY_AUDIO_FRAME_BUFFERED. When audio data buffering is fully finished, the status change will be notified.
  3. Execute MWGetAudioSignalStatus() to get audio signal status, and in this way users can know the valid audio channels, audio sampling rate, and depth etc.
  4. MWCaptureAudioFrame() contains data multiple channels of data. If the channel status is invalid, then its value is 0. Therefore, by simply extracting the data from each channel according to the storage principle, and compiling the data to a file in sequence, users can get the audio file.

One thing to emphasize is that, the audio data got from SDK is in the order of left channel 0,1,2,3, and right channel 0,1,2,3. However, when it’s complied to file, their order changed to L 0, R 0, L 1, R 1... The processing method is flexible.

      5. The capture device follows to the input signal source to capture audio streams. It captures in the default format. it’s impossible to to set the capture parameters, such as resampling issue, which should be dealt with by users.

In all, the capture device processes single channel and multiple channels of audio in different methods. By default, it captures max 8 channels. It’s possible to execute MWGetAudioSignalStatus() to get valid audio channels for audio data processing.

It’s emphasized that, for the audio source with 16bit depth(2 bytes), users can right shift the 4-byte source data by 16bit to get the valid audio data.

Examples \ Applications \ MultiAudioCapture contains a demo for multi-channel audio capture.