Skip to content
Snippets Groups Projects
Commit e63e159e authored by Marina Kreme's avatar Marina Kreme
Browse files

fix bugs

parent a05439ee
No related branches found
No related tags found
No related merge requests found
Pipeline #5963 passed
...@@ -11,7 +11,7 @@ dbstack; ...@@ -11,7 +11,7 @@ dbstack;
%% %%
loc_source='bird'; loc_source='bird';
wideband_src='car'; wideband_src='car';
setting = 7; setting = 6;
if setting == 1 if setting == 1
...@@ -22,54 +22,8 @@ if setting == 1 ...@@ -22,54 +22,8 @@ if setting == 1
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.2
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.3
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.5
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 2 elseif setting == 2
win_type = 'gauss';
win_dur = 128 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 3
win_type = 'hann';
win_dur = 128 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 4
win_type = 'hann'; win_type = 'hann';
win_dur = 256/8000; win_dur = 256/8000;
hop_ratio = 1/8; hop_ratio = 1/8;
...@@ -77,7 +31,8 @@ elseif setting == 4 ...@@ -77,7 +31,8 @@ elseif setting == 4
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 5
elseif setting == 3
win_type = 'hann'; win_type = 'hann';
win_dur = 512/8000; win_dur = 512/8000;
...@@ -86,8 +41,8 @@ elseif setting == 5 ...@@ -86,8 +41,8 @@ elseif setting == 5
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 6
elseif setting == 4
win_type = 'hann'; win_type = 'hann';
win_dur = 512/8000; win_dur = 512/8000;
hop_ratio = 1/8; hop_ratio = 1/8;
...@@ -95,25 +50,17 @@ elseif setting == 6 ...@@ -95,25 +50,17 @@ elseif setting == 6
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 7
win_type = 'gauss'; elseif setting == 5
win_dur = 256/8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 7.1
win_type = 'gauss'; win_type = 'gauss';
win_dur = 256 / 8000; win_dur = 128 / 8000;
hop_ratio = 1 / 4; hop_ratio = 1 / 4;
nbins_ratio = 4; nbins_ratio = 4;
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 8 elseif setting == 6
win_type = 'gauss'; win_type = 'gauss';
win_dur = 256 / 8000; win_dur = 256 / 8000;
...@@ -122,23 +69,15 @@ elseif setting == 8 ...@@ -122,23 +69,15 @@ elseif setting == 8
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 9 elseif setting == 7
win_type = 'gauss'; win_type = 'gauss';
win_dur = 256 / 8000; win_dur = 256 / 8000;
hop_ratio = 1 / 4; hop_ratio = 1 / 8;
nbins_ratio = 4; nbins_ratio = 2;
tol_subregions = 0; tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type); [alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 10
win_type = 'gauss';
win_dur = 256 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
end end
...@@ -147,7 +86,7 @@ end ...@@ -147,7 +86,7 @@ end
nb_areas='1area'; nb_areas='1area';
pwd; pwd;
fig_dir =['fig_solve_', nb_areas,'_car_cuicui_', win_type]; fig_dir =['fig_solve_', nb_areas,'_car_bird_', win_type];
if ~exist(fig_dir,'dir') if ~exist(fig_dir,'dir')
mkdir(fig_dir); mkdir(fig_dir);
end end
...@@ -165,6 +104,7 @@ fprintf('win_len:%.f\n', length(dgt_params.win)); ...@@ -165,6 +104,7 @@ fprintf('win_len:%.f\n', length(dgt_params.win));
fprintf('hop:%.f\n', dgt_params.hop); fprintf('hop:%.f\n', dgt_params.hop);
fprintf('n_bins:%.f\n', dgt_params.nbins); fprintf('n_bins:%.f\n', dgt_params.nbins);
%% create subregions %% create subregions
mask_bool = mask; mask_bool = mask;
...@@ -278,7 +218,7 @@ plot(lambda_oracle,sdr_wideband(lambda_oracle),'gs','MarkerSize',12); ...@@ -278,7 +218,7 @@ plot(lambda_oracle,sdr_wideband(lambda_oracle),'gs','MarkerSize',12);
plot(lambda_est,sdr_wideband(lambda_est),'o','MarkerSize',12) plot(lambda_est,sdr_wideband(lambda_est),'o','MarkerSize',12)
plot(lambda_true_energy,sdr_wideband(lambda_true_energy),'*','MarkerSize',12) plot(lambda_true_energy,sdr_wideband(lambda_true_energy),'*','MarkerSize',12)
plot(1,sdr_wideband(1),'o','MarkerSize',12) plot(1,sdr_wideband(1),'o','MarkerSize',12)
legend('SDR', 'TFF-O','TFF-1', 'TFF-E','Zero fill'); legend('SDR', 'TFF-O','TFF-1', 'TFF-P','Zero fill');
xlabel('$\lambda$','Interpreter','latex') xlabel('$\lambda$','Interpreter','latex')
ylabel('SDR(dB)') ylabel('SDR(dB)')
...@@ -306,7 +246,7 @@ xlabel('$\lambda$','Interpreter','latex') ...@@ -306,7 +246,7 @@ xlabel('$\lambda$','Interpreter','latex')
ylabel('IS (dB)') ylabel('IS (dB)')
set(gca,'XScale','log'); set(gca,'XScale','log');
grid() grid()
legend('SDR','TFF-O','TFF-1','TFF-E','Zero fill') legend('SDR','TFF-O','TFF-1','TFF-P','Zero fill')
axis tight; axis tight;
saveas(gcf,fullfile(fig_dir, 'tuning_lambda_IS.pdf')); saveas(gcf,fullfile(fig_dir, 'tuning_lambda_IS.pdf'));
...@@ -333,10 +273,8 @@ plot(lambda_oracle, is_wideband(lambda_oracle), 'go','LineWidth',3) ...@@ -333,10 +273,8 @@ plot(lambda_oracle, is_wideband(lambda_oracle), 'go','LineWidth',3)
plot(1, is_wideband(1), 'mo','LineWidth',3) plot(1, is_wideband(1), 'mo','LineWidth',3)
axis tight; axis tight;
legend('SDR','TFF-1','TFF-E','TFF-O','Zero fill','Location','northwest'); legend('SDR','TFF-1','TFF-P','TFF-P','Zero fill','Location','northwest');
xlabel('$\lambda$','Interpreter','latex') xlabel('$\lambda$','Interpreter','latex')
ylabel('IS divergence') ylabel('IS divergence')
set(gca, 'FontSize', 20, 'fontName','Times'); set(gca, 'FontSize', 20, 'fontName','Times');
...@@ -346,7 +284,7 @@ saveas(gcf,fullfile(fig_dir, 'tuning_lambda_SDR_IS.pdf')); ...@@ -346,7 +284,7 @@ saveas(gcf,fullfile(fig_dir, 'tuning_lambda_SDR_IS.pdf'));
%% Reconstructed signals %% Reconstructed signals
tf_mat_mix = compute_dgt(signals.mix, dgt );
x_oracle = x_rec(lambda_oracle); x_oracle = x_rec(lambda_oracle);
wav_write('x_oracle.wav', x_oracle, signal_params.fs); wav_write('x_oracle.wav', x_oracle, signal_params.fs);
...@@ -358,16 +296,17 @@ x_true_energy = x_rec(lambda_true_energy); ...@@ -358,16 +296,17 @@ x_true_energy = x_rec(lambda_true_energy);
wav_write('x_true_energy.wav', x_true_energy, signal_params.fs); wav_write('x_true_energy.wav', x_true_energy, signal_params.fs);
x_zero = solver_tfgm_zero(tf_mat_mix, mask, idgt); x_zero = zero_fill_solver(x_mix, mask, dgt, idgt, dgt_params,...,
signal_params, fig_dir);
wav_write('x_zero_fill.wav', x_zero, signal_params.fs); wav_write('x_zero_fill.wav', x_zero, signal_params.fs);
x_interp= solver_tfgm_interp(tf_mat_mix, mask, idgt); x_interp= interpolation_solver(x_mix, mask, dgt, idgt, dgt_params,...,
signal_params, fig_dir);
wav_write('x_interp.wav', x_zero, signal_params.fs); wav_write('x_interp.wav', x_zero, signal_params.fs);
%% Sdr %% Sdr
sdr_oracle = sdr(x_wideband, x_oracle); sdr_oracle = sdr(x_wideband, x_oracle);
sdr_est = sdr(x_wideband, x_est); sdr_est = sdr(x_wideband, x_est);
sdr_true_energy = sdr(x_wideband, x_true_energy); sdr_true_energy = sdr(x_wideband, x_true_energy);
...@@ -386,8 +325,6 @@ is_interp= itakura_saito_dist_spectrum(x_wideband,x_interp); ...@@ -386,8 +325,6 @@ is_interp= itakura_saito_dist_spectrum(x_wideband,x_interp);
%% %%
fprintf('Oracle lambda: %f\n', lambda_oracle); fprintf('Oracle lambda: %f\n', lambda_oracle);
fprintf('SDR for oracle lambda: %f dB\n',sdr_oracle); fprintf('SDR for oracle lambda: %f dB\n',sdr_oracle);
...@@ -436,9 +373,6 @@ axis tight; ...@@ -436,9 +373,6 @@ axis tight;
saveas(gcf,fullfile(fig_dir,'spectrogram_TFF-O.pdf')); saveas(gcf,fullfile(fig_dir,'spectrogram_TFF-O.pdf'));
figure; figure;
plot_spectrogram(x_est, dgt_params, signal_params, dgt) plot_spectrogram(x_est, dgt_params, signal_params, dgt)
...@@ -451,9 +385,9 @@ saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-1.pdf')); ...@@ -451,9 +385,9 @@ saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-1.pdf'));
figure; figure;
plot_spectrogram(x_true_energy, dgt_params, signal_params,dgt) plot_spectrogram(x_true_energy, dgt_params, signal_params,dgt)
title(['TFF-E SDR= ', num2str(sdr_true_energy,4),'dB ','IS=',num2str(is_true_energy) ]) title(['TFF-P SDR= ', num2str(sdr_true_energy,4),'dB ','IS=',num2str(is_true_energy) ])
set(gca, 'FontSize', 20, 'fontName','Times'); set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-E.pdf')); saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-P.pdf'));
%% %%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment