c# - NAudio playing multiple sounds together gives exception "All mixer inputs must have the same WaveFormat" -


I am trying to run several sound files at the same time using the AddMixerInput method of NAudio MixingSampleProvider. I am using the audioplayback engine found on this page:

However, when I try to play different files, I get an exception when running some sounds: "All mixer inputs Should be the same wave format "I do not have the same sample rate in sound files (I think some files are 7046 as sample rate rather than 4446)

Is there a way to modify the cached sand class so that sample rates be converted to 44100 in everyone's reading?

Thank you!

You can combine the audio stream together without changing the same sample rate in a resizeler There are three ways to reach:

  • WaveFormatConversionStream - This uses the ACM resampler component under the hood. Note that you may have a problem with resizing the IEEE float with this one.
  • MediaFundation Receptor - This mediafoundation uses this allows you to adjust the respling quality
  • WdlResamplingSampleProvider - This is the latest in the latest NAudio, and providing fully managed resampling Does.

As well as matching the sample rates, you also need matching channel numbers. There are several ways to convert mono into stereo and vice versa in Nadio.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -