Search code examples
c#naudiomixing

How to mix a lot of audio files with NAudio?


For example, I have 5 audio files. And, I want to combine these files with C# NAudio.

<------- A.wav ------->    <---- B.wav ---->
      <---- C.wav ---->  <-- D.wav --> <- E.wav ->

I goggled but I can find a solution which apply this situation.

<----- A.wav ----->
<-- B.wav -->
<------ C.wav ------>

How can I combine a lot of audio files with each length and position?


Solution

  • You can do this with the MixingSampleProvider Use an AudioFileReader for each file. Then use the DelayBy extension on ISampleProvider to insert silence at the start of each file so they begin at the correct position.