Open Dingdong8187 opened 7 years ago
Running the following code produces a vocal_estimate.wav file that includes the background music as well.
import numpy as np import matplotlib.pyplot as plt from untwist.data import Wave, RatioMask from untwist.transforms import STFT, ISTFT from untwist.factorizations import RPCA stft = STFT() istft = ISTFT() rpca = RPCA(iterations = 100) x = Wave.read("/home/usama/mix5.wav") X = stft.process(x[:,0]) (L,S) = rpca.process(X.magnitude()) M = RatioMask(S, L) v = istft.process(X * M) v.write("vocal_estimate.wav") plt.subplot(4,1,1) X.plot(label_x = False, title = "mixture") plt.subplot(4,1,2) L.plot(label_x = False, title = "L") plt.subplot(4,1,3) S.plot(label_x = False, title = "S") plt.subplot(4,1,4) M.plot(title="estimated mask") plt.show()
Hi,
Unless @g-roma can help, I'll try to look at this when I have more time, which will be in a few weeks time.
Thanks
Perhaps the revised example makes more sense now?
Running the following code produces a vocal_estimate.wav file that includes the background music as well.