ICA for blind source separation clarification question

I'm currently trying to implement FastICA for blind source separation from scratch.

The code below does not generate W, the umixing matrix, correctly. When I matrix multiplied the outputs w1 and w2 with the mixed signal, the output was not the separated signals. I know the ICA is correct since I had run it on non-audio case, but is there an extra step I'm missing to adapt ICA to blind source separation for audio streams?

Here is the code:

import sympy as sy
# whitening
x = make_mean_zero(x) #make zero mean
dplot = 5
w,v = np.linalg.eig(np.cov(x))
M = (v/sqrt(w)).T
unit_x = dot(M,x) #diagonalize with unit variance
unit_x = unit_x.reshape((2, 1000))

def gen_expect(x):
mean1 = sum(x[0,])/N
mean2 = sum(x[1,])/N
return np.array([[mean1],[mean2]])

df = lambda x: tanh(x)
def ddf(x):
for i in range(1, 1000):
x[i] = 1/sy.cosh(x[i])**2
return x

def ica(w):
i=0
while True:
i+=1
g1 = gen_expect(df(dot(w,unit_x))*unit_x)
g2 = gen_expect(ddf(dot(w,unit_x)))
g1 = np.array([g1[0, 0], g1[1,0]])
g2 = np.array([g2[0, 0], g2[1,0]])
w_new = g1 - g2
w_new /= np.linalg.norm(w_new)
if abs(np.linalg.norm(w_new-w))<0.000001:
break
w = w_new
return w
print("now")
w1 = ica(np.random.rand(2))
print("w1")
print(w1)
w2 = array([-w1[1],w1[0]]) # orthog

• Maybe the hypethesis of ICA aren't true anymore. In particular, it could be that the mixture is of convolutive nature and not instantaneous... – Florent Feb 27 '18 at 3:15