Skip to content

rpca_example outputs wav file identical to input #3

@Dingdong8187

Description

@Dingdong8187

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions