psd_noise_matrix = get_power_spectral_density_matrix(stft_noise_arr) print('Calc psd matrix done!') print(' psd_noise_matrix.shape = ', psd_noise_matrix.shape) ################################################################# # 6 - Apply MVDR type_reg = 1 reg_p = 0.001 w = get_mvdr_vector_svd(d_arr.T, psd_noise_matrix, type_reg=type_reg, r=reg_p) result_spec = apply_beamforming_vector(w, stft_mix_arr) ################################################################# # 6 inverse STFT and save sig_out = istft(result_spec.transpose((1, 0)), overlap=2) sf.write(r"out/out_mvdr_svd_type_{}_r_{}.wav".format(type_reg, reg_p), sig_out, sr) ################################################################# # 7.1 - Do align align_stft_arr = ds_align(stft_mix_arr, d_arr.T) ################################################################# # 7.2 save ds output result_spec = align_stft_arr.sum(axis=1) / (hor_mic_count * vert_mic_count) sig_out = istft(result_spec.transpose((1, 0)), overlap=2) sf.write(r"out/ds.wav", sig_out, sr)
stft_all_noise = copy.deepcopy(stft_all) for i in range(0, n_sensors): stft_all_noise[:, i, :] *= actual_mask psd_noise_matrix = get_power_spectral_density_matrix(stft_all_noise) ################################################################# # 5 -Regularisation psd matrix psd_noise_matrix = psd_noise_matrix + 0.01 * np.identity( psd_noise_matrix.shape[-1]) ################################################################# # 6 - Apply MVDR w = get_mvdr_vector(d_arr.T, psd_noise_matrix) result_spec = apply_beamforming_vector(w, stft_all) ################################################################# # 6 inverse STFT and save sig_out = istft(result_spec.transpose((1, 0)), overlap=2) sf.write(r"out/out_mvdr_mask.wav", sig_out, sr) ################################################################# # 7.1 - Do align align_stft_arr = ds_align(stft_all, d_arr.T) ################################################################# # 7.2 save ds output result_spec = align_stft_arr.sum(axis=1) / (hor_mic_count * vert_mic_count) sig_out = istft(result_spec.transpose((1, 0)), overlap=2) sf.write(r"out/ds.wav", sig_out, sr)