Last active
October 26, 2017 13:53
-
-
Save GiovanniBalestrieri/5e067f05e5d30021754ba398b6b0d3ba to your computer and use it in GitHub Desktop.
Adding sounds to a recorded wav file in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scikits.audiolab import wavread, wavwrite | |
data1, fs1, enc1 = wavread("finevite112.wav") | |
data2, fs2, enc2 = wavread("machine1.wav") | |
assert fs1 == fs2 | |
assert enc1 == enc2 | |
data2ok = np.split(data2,[len(data2)//2 - len(data1)//2, len(data2)//2 + len(data1)//2+1])[1] | |
for i in range(2,6): | |
result = 1 * data1 + i/10.0 * data2ok | |
wavwrite(result, str(i)+'result.wav',fs1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment