Search code examples
winapiaudioms-media-foundation

Is there a real-time audio mixing effect or MFT in MediaFoundation?


  • Because each channel of the audio input source may input data intermittently (for example, there may be no data for 10 seconds), I use the maximum input timeout strategy (for example, about 500 milliseconds) to decide whether to mute or not and use "linear regression algorithm" to achieve the audio mixing. The disadvantage here is that you need to cache enough pictures to barely Synchronize audio and video when recording MP4.
  • New to MediaFoundation's audio, I don’t want to reinventing the wheel anymore. I want to know whether there is a real-time multi-channel audio mixing MFT or similar library?

Solution

  • Audio mixing effect would 2+ inputs and 1 output MFT which mixes the inputs. There is no stock transform for this either, but question description suggests that you look for even more specialized transform.

    If your intent is to have one multichannel input but switch channels (does not make much sense to me but description is not clear either), stock Audio Resampler MFT can be used to select downmixing modes that you can switch on the go (conversion matrix is configurable).

    Nothing special is needed from this type of transforms to be of real-time grade. However depending on your situation there is still a chance that such transform alone does not satisfy your needs: such mixing transform will be a part of pipeline in front of certain buffering and change in mixing might have effect once the currently buffered data is played out. I believe this should not be a problem but if your understanding of real-time is real instant then you might have this problem as well.