I am trying to concatenate multiple audio files together using NAudio.
I have collection of byte arrays, where the byte arrays represent the individual audio tracks.
var samples = new List<ISampleProvider>();
foreach (var item in collection) {
ISampleProvider tempAudio = new RawSourceWaveStream(new MemoryStream(item), new WaveFormat()).ToSampleProvider();
samples.Add(tempAudio);
}
var playlist = new ConcatenatingSampleProvider(samples);
WaveFileWriter.CreateWaveFile("playlist.wav", playlist.ToWaveProvider());
However, the audio that is saved to the file "playlist.wav" does not sound like the audio before attempting to concatenate it. The audio sounds much faster and incoherent.