Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tff2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
skmad-suite
tff2020
Commits
6e2283a0
Commit
6e2283a0
authored
4 years ago
by
Marina Kreme
Browse files
Options
Downloads
Patches
Plain Diff
add doc
parent
9e6c8b77
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#5928
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/tfgm/datasets/get_mix.m
+39
-25
39 additions, 25 deletions
matlab/tfgm/datasets/get_mix.m
with
39 additions
and
25 deletions
matlab/tfgm/datasets/get_mix.m
+
39
−
25
View file @
6e2283a0
...
@@ -3,27 +3,29 @@ function [signals, dgt_params, signal_params, mask, mask_area, dgt,...,
...
@@ -3,27 +3,29 @@ function [signals, dgt_params, signal_params, mask, mask_area, dgt,...,
nbins_ratio
,
win_type
,
alpha
,
thres
,
radius
,
fig_dir
)
nbins_ratio
,
win_type
,
alpha
,
thres
,
radius
,
fig_dir
)
%%
%%
% Function that generates :
% Build the mix two sounds and the related time-frequency boolean mask.
% - the mixture of a wide-band spectrogram signal and a localized signal.
%
% - the mask from the two mixtures
%
%
% Inputs:
% Inputs:
% - loc_source(str): signal with localized spectrogram
% - loc_source(str): signal with localized spectrogram
% - wideband_src(str): signal with wideband spectrogram
% - wideband_src(str): signal with wideband spectrogram
% - gamma: integer (belong to ]0,1[)
% - gamma: integer (belong to ]0,1[)
% - win_dur: window duration (must be between 12 and 20 ms)
% - 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)
% - win_type (str): analysis window (hann or gauss)
% - alpha, thres, radius(real): smoothing parameter for the mask
% - alpha, thres, radius(real): smoothing parameter for the mask
% -fig_dir: directory
% -fig_dir: directory
- folder where figures are stored
%
%
% Outputs:
% Outputs:
% -signals(struct): contains wideband, localized and mixtures signals
% -signals(struct): contains wideband, localized and mixtures signals
% - dgt_params (struct): contains dgt parameters (hop, n_bins, win_type, win_len, win)
% - 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
% - signal_params (struct): contains the length of signal and sampling frequency
% - mask : binary mask
% - mask :
Time-frequency
binary mask
% - mask_are: binary mask area
% - mask_are
a
: binary mask area
% - dgt, idgt: Operator of
Gabor
transform and its inverse
% - dgt, idgt
(handle)
: Operator of
DGT
transform and its inverse
%
%
% Author : Marina KREME
% Author : Marina KREME
...
@@ -46,7 +48,6 @@ fs= fs_loc;
...
@@ -46,7 +48,6 @@ fs= fs_loc;
sig_len
=
length
(
x_loc
);
sig_len
=
length
(
x_loc
);
signal_params
=
generate_signal_parameters
(
fs
,
sig_len
);
signal_params
=
generate_signal_parameters
(
fs
,
sig_len
);
%% build mix signals
%% build mix signals
signals
=
generate_mix_signal
(
x_wb
,
x_loc
,
gamma
);
signals
=
generate_mix_signal
(
x_wb
,
x_loc
,
gamma
);
...
@@ -56,10 +57,11 @@ approx_win_len = 2.^round(log2(win_dur*fs));
...
@@ -56,10 +57,11 @@ approx_win_len = 2.^round(log2(win_dur*fs));
hop
=
approx_win_len
*
hop_ratio
;
hop
=
approx_win_len
*
hop_ratio
;
nbins
=
approx_win_len
*
nbins_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
%% generat
e binary
mask
[
dgt
,
idgt
]
=
get_stft_operators
(
dgt_params
,
signal_params
);
[
dgt
,
idgt
]
=
get_stft_operators
(
dgt_params
,
signal_params
);
tf_mat_wb
=
compute_dgt
(
signals
.
wideband
,
dgt
);
tf_mat_wb
=
compute_dgt
(
signals
.
wideband
,
dgt
);
...
@@ -76,43 +78,55 @@ title(['Mask Mix : mask-area = ',num2str(mask_area)]);
...
@@ -76,43 +78,55 @@ title(['Mask Mix : mask-area = ',num2str(mask_area)]);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
fig_dir
,
'mask_mix.pdf'
));
saveas
(
gcf
,
fullfile
(
fig_dir
,
'mask_mix.pdf'
));
%%
%%
figure
;
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)
figure
;
% title(['Wideband source - ', wideband_src]);
subplot
(
231
)
plot_spectrogram
(
signals
.
localized
,
dgt_params
,
signal_params
,
dgt
)
plot_spectrogram
(
signals
.
localized
,
dgt_params
,
signal_params
,
dgt
)
title
([
'Localized source - '
,
loc_source
]);
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
)
plot_spectrogram
(
signals
.
mix
,
dgt_params
,
signal_params
,
dgt
)
title
(
'Mix'
);
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
);
plot_mask
(
original_mask
,
hop
,
nbins
,
fs
);
title
(
'Original mask'
);
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
);
plot_mask
(
mask_after_imclose
,
hop
,
nbins
,
fs
);
title
(
'Smooth mask- after imclose'
);
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
);
plot_mask
(
mask_after_imopen
,
hop
,
nbins
,
fs
);
title
(
'Smooth and final mask - after impoen'
);
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
);
gabmul
=
gen_gabmul_operator
(
dgt
,
idgt
,
m
);
x_est
=
gabmul
(
signals
.
wideband
);
x_est
=
gabmul
(
signals
.
wideband
);
subplot
(
236
)
plot_spectrogram
(
x_est
,
dgt_params
,
signal_params
,
dgt
)
plot_spectrogram
(
x_est
,
dgt_params
,
signal_params
,
dgt
)
title
(
'Filtered wb'
)
title
(
'Filtered wb'
)
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
fig_dir
,
'
mix
_spectro
_mask
.pdf'
));
saveas
(
gcf
,
fullfile
(
fig_dir
,
'
zerofill
_spectro
gram
.pdf'
));
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment