I am trying to concatenate a list of wav files into a single continuous wav file. I have used the following snippet but the output is not correct, sounds almost like the files are on top of each other. audio_files
is a list with .wav filenames that are playing as expected.
This is my current code:
outfile = "sounds.wav"
data= []
for wav_file in audio_files:
w = wave.open(wav_file, 'rb')
data.append( [w.getparams(), w.readframes(w.getnframes())] )
w.close()
output = wave.open(outfile, 'wb')
output.setparams(data[0][0])
output.writeframes(data[0][1])
output.writeframes(data[1][1])
output.close()