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

add doc

parent 9e6c8b77
No related branches found
No related tags found
No related merge requests found
Pipeline #5928 passed
......@@ -3,27 +3,29 @@ function [signals, dgt_params, signal_params, mask, mask_area, dgt,...,
nbins_ratio, win_type, alpha, thres, radius, fig_dir)
%%
% Function that generates :
% - the mixture of a wide-band spectrogram signal and a localized signal.
% - the mask from the two mixtures
% Build the mix two sounds and the related time-frequency boolean mask.
%
%
% Inputs:
% - loc_source(str): signal with localized spectrogram
% - wideband_src(str): signal with wideband spectrogram
% - gamma: integer (belong to ]0,1[)
% - win_dur: window duration (must be between 12 and 20 ms)
% - hop_ratio, nbins_ration: real
% - hop_ratio (float): Ratio of the window length that will be set as hop size for the DGT.
% - nbins_ratio: Factor that will be applied to the window length to compute the
% number of bins in the DGT.
%
% - win_type (str): analysis window (hann or gauss)
% - alpha, thres, radius(real): smoothing parameter for the mask
% -fig_dir: directory
% -fig_dir: directory - folder where figures are stored
%
% Outputs:
% -signals(struct): contains wideband, localized and mixtures signals
% - dgt_params (struct): contains dgt parameters (hop, n_bins, win_type, win_len, win)
% - signal_params (struct): contains the length of signal and sampling frequency
% - mask : binary mask
% - mask_are: binary mask area
% - dgt, idgt: Operator of Gabor transform and its inverse
% - mask : Time-frequency binary mask
% - mask_area: binary mask area
% - dgt, idgt (handle): Operator of DGT transform and its inverse
%
% Author : Marina KREME
......@@ -46,7 +48,6 @@ fs= fs_loc;
sig_len = length(x_loc);
signal_params = generate_signal_parameters(fs, sig_len);
%% build mix signals
signals = generate_mix_signal(x_wb, x_loc, gamma);
......@@ -56,10 +57,11 @@ approx_win_len = 2.^round(log2(win_dur*fs));
hop = approx_win_len* hop_ratio;
nbins = approx_win_len * nbins_ratio;
dgt_params = generate_dgt_parameters(win_type, approx_win_len, hop, nbins, sig_len);
dgt_params = generate_dgt_parameters(win_type, approx_win_len, hop,...,
nbins, sig_len);
%% generat mask
%% generate binary mask
[dgt, idgt] = get_stft_operators(dgt_params, signal_params);
tf_mat_wb = compute_dgt(signals.wideband, dgt );
......@@ -76,43 +78,55 @@ title(['Mask Mix : mask-area = ',num2str(mask_area)]);
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'mask_mix.pdf'));
%%
figure;
plot_spectrogram(signals.wideband, dgt_params, signal_params, dgt)
title(['Wideband source - ', wideband_src]);
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'mix_spectro_mask.pdf'));
% plot_spectrogram(signals.wideband, dgt_params, signal_params, dgt)
% title(['Wideband source - ', wideband_src]);
subplot(231)
figure;
plot_spectrogram(signals.localized, dgt_params, signal_params, dgt)
title(['Localized source - ',loc_source]);
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'loc_source.pdf'));
subplot(232)
figure;
plot_spectrogram(signals.mix, dgt_params, signal_params, dgt)
title('Mix');
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'mix_spectrogram.pdf'));
subplot(233)
figure;
plot_mask(original_mask, hop, nbins, fs);
title('Original mask');
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'raw_mask.pdf'));
subplot(234)
figure;
plot_mask(mask_after_imclose, hop, nbins, fs);
title('Smooth mask- after imclose');
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'mask_after_imclose.pdf'));
subplot(235)
figure;
plot_mask(mask_after_imopen, hop, nbins, fs);
title('Smooth and final mask - after impoen');
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'mask_after_imopen.pdf'));
m = ~mask;
figure;
m = ~mask;
gabmul = gen_gabmul_operator(dgt, idgt,m);
x_est = gabmul(signals.wideband);
subplot(236)
plot_spectrogram(x_est, dgt_params, signal_params, dgt)
title('Filtered wb')
saveas(gcf,fullfile(fig_dir, 'mix_spectro_mask.pdf'));
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'zerofill_spectrogram.pdf'));
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment