import wave, array # changed from https://stackoverflow.com/a/43163543/699934 def make_stereo(file1, file2, output): ifile1 = wave.open(file1) ifile2 = wave.open(file2) print(ifile1.getparams()) # (1, 2, 44100, 2013900, 'NONE', 'not compressed') (nchannels, sampwidth, framerate, nframes, comptype, compname) = ifile1.getparams() assert ifile1.getparams() == ifile2.getparams() assert comptype == 'NONE' # Compressed not supported yet array_type = {1:'B', 2: 'h', 4: 'l'}[sampwidth] left_channel = array.array(array_type, ifile1.readframes(nframes))[::nchannels] right_channel = array.array(array_type, ifile2.readframes(nframes))[::nchannels] ifile1.close() ifile2.close() stereo = 2 * left_channel stereo[0::2] = left_channel stereo[1::2] = right_channel ofile = wave.open(output, 'w') ofile.setparams((2, sampwidth, framerate, nframes, comptype, compname)) ofile.writeframes(stereo) ofile.close()