I'm attempting to blend multiple wav files into a single file. The output plays only silence in windows media player and can't be read in pygame. Here's what I did:
oh = scipy.io.wavfile.read('Downloads\\sounds\\OH10.wav')
sns = scipy.io.wavfile.read('Downloads\\sounds\\snshort.wav')
diff = len(oh[1])-len(sns[1])
spacer = np.array([0]*diff)
newsns = np.concatenate([spacer, sns[1]])
x = np.hstack((oh[1], newsns))
scipy.io.wavfile.write('testing.wav', rate=44100, data=x.T)
Basically I want two sounds to be combined into one. I added the spacer so that the arrays are of same length.
from pygame import mixer
mixer.pre_init(44100, 16, 2, 4096)
mixer.init()
mixer.Sound('testing.wav').play()
error Traceback (most recent call last)
<ipython-input-306-6be10c568430> in <module>
3 pygame.init() #turn all of pygame on.
4 pygame.mixer.init()
----> 5 pygame.mixer.Sound('testing.wav').play()
error: Unable to open file 'testing.wav'