deep-clustering
deep-clustering copied to clipboard
how can i fix the following errors? -- audio_test.py
frame_out1 = np.fft.ifft(out1).astype(np.float64)
Error: ComplexWarning: Casting complex values to real discards the imaginary part frame_out1 = np.fft.ifft(out1.real).astype(np.float64)
The error is due to your version of numpy doesn't allow casting the type from complex number(the output of the IFFT) to float64(the time domain signal).
Actually the output of the ifft should be pure real number given the input is conjugate symmetric, but the imaginary part will not strictly equal to zero due to the computational accuracy. So you can try discarding the imaginary part first, something like frame_out1 = np.fft.ifft(out1).real().astype(np.float64).
The error is due to your version of numpy doesn't allow casting the type from complex number(the output of the IFFT) to float64(the time domain signal).
Actually the output of the ifft should be pure real number given the input is conjugate symmetric, but the imaginary part will not strictly equal to zero due to the computational accuracy. So you can try discarding the imaginary part first, something like frame_out1 = np.fft.ifft(out1).real().astype(np.float64).
yeah, I have fixed this problem by using your advise. But why I meet another problem that the reconstructed audio can't play.
You can check the values of the output audio data array to see if it is legit. If not, probably sth. in the model went wrong. If it is legit, then sth. went wrong when you trying to write data into the audio file
frame_out1 = np.fft.ifft(out1).astype(np.float64) Error: ComplexWarning: Casting complex values to real discards the imaginary part frame_out1 = np.fft.ifft(out1.real).astype(np.float64)
May I ask that what did you do to solve the problem which the reconstructed audio can not play?
frame_out1 = np.fft.ifft(out1).astype(np.float64) Error: ComplexWarning: Casting complex values to real discards the imaginary part frame_out1 = np.fft.ifft(out1.real).astype(np.float64)
May I ask that what did you do to solve the problem which the reconstructed audio can not play?
frame_out1 = np.fft.irfft(out_stft1).real.astype(np.float32)