if f2a is None:
// initialize the mel filter bank after grabbing the first frame
f2a = melfb(sample_rate, len(frame), num_frequency_bands, mel_filter_width)
f2a = f2a[:,:(round(len(frame)/2) + 1)]
n = f2a.shape[0]
// initialze the state vector
After Change
//% map back to FFT grid, flatten bark loop gain
//sf2a = sum(f2a);
normalize_f2a = numpy.sum(f2a, axis=0)
normalize_f2a[normalize_f2a == 0] = 1.0
normalize_f2a = 1.0 / normalize_f2a
// initialze the state vector
state = numpy.zeros( (num_frequency_bands, 1) )[0]
pass
// FFT each frame
D = scipy.fft(frame)
// multiply by f2a
audiogram = numpy.dot(f2a, numpy.abs(D))
//// DPWE
// state = max([alpha*state,audgram(:,i)],[],2);
// fbg(:,i) = state;
// ...
//
state = numpy.maximum(alpha * state, audiogram)
//E = diag(1./(sf2a+(sf2a==0))) * f2a" * fbg;
E = normalize_f2a * numpy.dot(f2a.T, state);
//% Remove any zeros in E (shouldn"t be any, but who knows?)
//E(E(:)<=0) = min(E(E(:)>0));
//% invert back to waveform
//y = istft(D./E);
y = scipy.ifft(D/E)
pass
pass