Convolving Room Impulse Response with a Wav File (python) I have written the following code which is supposed to put echo over an available sound file. Unfortunately the output is a very noisy result which I don't exactly understand. Can anybody help me with regard to this? Is there any skipped step?



#convolving a room impulse response function with a sound sample both of stereo type
from scipy.io import wavfile
inp = wavfile.read(sound_path + sound_file_name)
IR = wavfile.read(IR_path + IR_file_name)
if inp[0] != IR[0]:
    print "Size mismatch"
    sys.exit(-1)
else:
    rate = inp[0]
print sound_file_name
out_0 = fftconvolve(inp[1][:, 1], IR[1][:, 1])
out_1 = fftconvolve(inp[1][:, 1], IR[1][:, 1])
in_counter += 1
out = np.vstack((out_0, out_1)).T
wavfile.write(sound_path + sound_file_name + '_echoed.wav', rate, out)
The way you read the files is a little odd.  The method used here is clearer with respect to the sampling rate and the signal.
You will note that the above example calls pcm2float after reading.  This may be the cause of your problem.  The wave reader returns an array of ints.  Processing those (quite large) values may well cause problems.  Try converting your wave data to floats before doing the convolution.