Audio Resampler DSP

The Audio Resampler performs one or both of the following actions on an audio stream.

  • Change the sampling rate.
  • Change the number of channels.

CLSID

CLSID_CResamplerMediaObject

Interfaces

Formats

PCM or IEEE floating-point

The media type must specify an uncompressed PCM or floating-point audio format.

Properties

Required Attributes

The resampler requires the following attributes to be set on it:

Custom Channel Mapping

The audio resampler maps the input audio channels to the output audio channels, based on the following information:

  • The number of channels. This is given in the MF_MT_AUDIO_NUM_CHANNELS attribute of the media type, or the nChannels member of the WAVEFORMATEX structure.
  • The channel mask, which assigns channels to speaker position. The channel mask is given in the MF_MT_AUDIO_CHANNEL_MASK attribute of the media type, or the dwChannelMask member of the WAVEFORMATEXTENSIBLE structure.
  • A matrix of mapping weights.

The matrix contains a series of weights, such that each output channel is a weighted average of the input channels.

You can specify a custom matrix for channel mapping by calling IWMResamplerProps::SetUserChannelMtx or by setting the MFPKEY_WMRESAMP_CHANNELMTX property. If a custom matrix is not provided, the Audio Resampler uses a set of default matrices.

Default Channel Mapping

If you do not specify a custom matrix, the Audio Resampler DSP uses default values for channel mapping.

In the tables that follow, the channels are abbreviated:

  • L: Left
  • R: Right
  • C: Center
  • LFE: Low Frequence Effects
  • BL: Back Left
  • BR: Back Right
  • SL: Surround Left
  • SR: Surround Right

The following table shows the default coefficients for mapping 6 channels (mask 0x3F) to 2 channels.

LRCLFEBLBR
L0.31400.2220.0310.2680.164
R00.3140.2220.0310.1640.268

 

The following table shows the default coefficients for mapping 6 channels (mask 0x60F) to 2 channels.

LRCLFESLSR
L0.32000.2260.0320.2920.130
R00.3200.2260.0320.1300.292

 

The following table shows the default coefficients for mapping 6 (mask 0x3F or 0x60F) channels to 1 channel.

LRCLFEBL(SL)BR(SR)
C0.1920.1920.1920.0380.1920.192

 

The following table shows the default coefficients for mapping 8 channels (mask 0x63F) to 2 channels.

LRCLFEBLBRSLSR
L0.22200.1570.0220.1890.1160.2030.090
R00.2220.1570.0220.1160.1890.0900.203

 

The following table shows the default coefficients for mapping 8 channels (mask 0x63F) to 1 channel.

LRCLFEBLBRSLSR
C0.1390.1390.1390.0280.1390.1390.1390.139

 

The following table shows the default coefficients for mapping 8 channels (mask 0x63F) to 6 channels (mask 0x3F).

LRCLFEBLBRSLSR
L 0.518 000000.1890
R00.518000000.189
C000.51800000
LFE0000.5180000
BL00000.51800.4820
BR00000 0.51800.482

 

The following table shows the default coefficients for mapping 8 channels (mask 0x63F) to 6 channels (mask 0x60F).

LRCLFEBLBRSLSR
L0.4470000000
R00.447000000
C000.44700000
LFE0000.447 0000
SL0000 0.4290.1240.4470
SR00000.1240.42900.447

 

To understand how to interpret the tables of coefficients, consider the first table, which maps 6 channels to 2. The first row of the table (0.314, 0, 0.222, 0.031, 0.268, 0.164) is a vector of weights that specifies how heavily each input channel contributes to the left channel of the output. The second row of the table (0, 0.314, 0.222, 0.031, 0.164, 0.268) is a vector of weights that specifies how heavily each input channel contributes to the right channel of the output.

The following formulas show how the output channels are calculated.


L_out = L*0.314 + C*0.222 + LFE*0.031 + BL*0.268 + BR*0.164 
R_out = R*0.314 + C*0.222 + LFE*0.031 + BL*0.164 + BR*0.268

Note  If you use the Audio Resampler DSP to increase the number of channels, the added channels will be assigned values of 0.

Output Quality

You can specify the output quality of the Audio Resampler DSP by calling IWMResamplerProps::SetHalfFilterLength or by setting the MFPKEY_WMRESAMP_FILTERQUALITY property. If you do not specify the output quality, the Audio Resampler DSP uses a default quality value of 30.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Wmcodecdsp.h

DLL

Resampledmo.dll

See also

Digital Signal Processors

 

 

Community Additions

ADD
Show:
© 2014 Microsoft