I'm at very beginning in programming, and I'm studying Python. I want to make a little piece of software who looks into a directory with audio files, and merge them into a single audio file. Here is my current code:
import glob
#import os
import wave
fil = raw_input("Qual o diretorio ?")
#files = os.listdir(fil)
files = glob.glob(fil)
infiles = files
outfile = "merged.wav"
data= []
for infile in range(len(infiles)):
w = wave.open(infile, '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()
I've based the code on this post merging two wav files. My idea was to use glob to populate an array, and iterate to get all the files but I'm getting an attribute error. What could I do?