Hey folks,
I am working on a project where I need to join several WAV files. My Code works totally fine,
but you hear clearly a clicking noise between two joined WAV files. That is an huge issue.
I am an audio engineer. When I work, with e.g. consecutive samples in a DAW (Digital Audio Workstation) and I want to prevent this clicking noise between two WAV samples then I have to create a crossover fade (basically this is a fadeout on the first sample and a fade in on the next sample).
Therefore my question would be if I can create such a crossover fade while concatenating two WAV files.
I provide my C# code below how I concatenate WAV files. This works for WAV files which are in the same "format". I found this piece of Code on (http://stackoverflow.com/questions/6777340/how-to-join-2-or-more-wav-files-together-programatically).
Thank you for advice and a solution.
Best regards,
Alex
```
public static void Concatenate(string outputFile, IEnumerable<string> sourceFiles)
{
byte[] buffer = new byte[1024];
WaveFileWriter waveFileWriter = null;
try
{
foreach (string sourceFile in sourceFiles)
{
using (WaveFileReader reader = new WaveFileReader(sourceFile))
{
if (waveFileWriter == null)
{
// first time in create new Writer
waveFileWriter = new WaveFileWriter(outputFile, reader.WaveFormat);
}
else
{
if (!reader.WaveFormat.Equals(waveFileWriter.WaveFormat))
{
throw new InvalidOperationException("Can't concatenate WAV Files that don't share the same format");
}
}
int read;
while ((read = reader.Read(buffer, 0, buffer.Length)) > 0)
{
waveFileWriter.WriteData(buffer, 0, read);
}
}
}
}
finally
{
if (waveFileWriter != null)
{
waveFileWriter.Dispose();
}
}
}
```