Skip to content

Commit c7d5e5e

Browse files
committed
Merge branch 'master' into audiowrite
* master: Return delay offset from delayline() (#82) New Handling of delayline and fractional delay (#50) Fix dos line endings Conflicts: SFS_binaural_synthesis/auralize_ir.m SFS_binaural_synthesis/compensate_headphone.m
2 parents d3803bf + 64efec8 commit c7d5e5e

File tree

109 files changed

+8140
-7920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+8140
-7920
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changes in the Sound Field Synthesis-Toolbox. Recent changes on top.
44
- fix impulse response interpolation for three points
55
- add the ability to apply modal weighting window to NFC-HOA in time domain
66
- change license to MIT
7+
- update delayline() config settings
8+
- add Lagrange and Thiran filters to delayline()
79

810
2.1.0 (10. March 2016)
911

SFS_analysis/freq_response_localwfs.m

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
function varargout = freq_response_localwfs(X,xs,src,conf)
2-
%FREQ_RESPONSE_WFS simulates the frequency response for WFS at the given
3-
%listener position
4-
%
5-
% Usage: [S,f] = freq_response_wfs(X,xs,src,conf)
6-
%
7-
% Input parameters:
8-
% X - listener position / m
9-
% xs - position of virtual source / m
10-
% src - source type of the virtual source
11-
% 'pw' -plane wave
12-
% 'ps' - point source
13-
% 'fs' - focused source
14-
% conf - configuration struct (see SFS_config)
15-
%
16-
% Output parameters:
17-
% S - simulated frequency response
18-
% f - corresponding frequency axis / Hz
19-
%
20-
% FREQ_RESPONSE_WFS(X,xs,src,conf) simulates the frequency response of the
21-
% sound field at the given position X. The sound field is simulated for the
22-
% given source type (src) using a monochromatic WFS driving function.
23-
%
24-
% See also: sound_field_mono_wfs, sound_field_imp_wfs
25-
26-
%*****************************************************************************
1+
function varargout = freq_response_localwfs(X,xs,src,conf)
2+
%FREQ_RESPONSE_WFS simulates the frequency response for WFS at the given
3+
%listener position
4+
%
5+
% Usage: [S,f] = freq_response_wfs(X,xs,src,conf)
6+
%
7+
% Input parameters:
8+
% X - listener position / m
9+
% xs - position of virtual source / m
10+
% src - source type of the virtual source
11+
% 'pw' -plane wave
12+
% 'ps' - point source
13+
% 'fs' - focused source
14+
% conf - configuration struct (see SFS_config)
15+
%
16+
% Output parameters:
17+
% S - simulated frequency response
18+
% f - corresponding frequency axis / Hz
19+
%
20+
% FREQ_RESPONSE_WFS(X,xs,src,conf) simulates the frequency response of the
21+
% sound field at the given position X. The sound field is simulated for the
22+
% given source type (src) using a monochromatic WFS driving function.
23+
%
24+
% See also: sound_field_mono_wfs, sound_field_imp_wfs
25+
26+
%*****************************************************************************
2727
% The MIT License (MIT) *
2828
% *
2929
% Copyright (c) 2010-2016 SFS Toolbox Team *
@@ -49,63 +49,63 @@
4949
% The SFS Toolbox allows to simulate and investigate sound field synthesis *
5050
% methods like wave field synthesis or higher order ambisonics. *
5151
% *
52-
% http://sfstoolbox.org sfstoolbox@gmail.com *
53-
%*****************************************************************************
54-
55-
56-
%% ===== Checking of input parameters ==================================
57-
nargmin = 4;
58-
nargmax = 4;
59-
narginchk(nargmin,nargmax);
60-
isargposition(X);
61-
isargxs(xs);
62-
isargchar(src);
63-
isargstruct(conf);
64-
65-
66-
%% ===== Configuration ==================================================
67-
% Plotting result
68-
useplot = conf.plot.useplot;
69-
showprogress = conf.showprogress;
70-
% Disable progress bar for sound field function
71-
conf.showprogress = false;
72-
% Check type of secondary sources to use
73-
if strcmp('2D',conf.dimension)
74-
greens_function = 'ls';
75-
else
76-
greens_function = 'ps';
77-
end
78-
79-
80-
%% ===== Computation ====================================================
81-
% Get the position of the loudspeakers
82-
x0_real = secondary_source_positions(conf);
83-
% Generate frequencies (10^0-10^5)
84-
f = logspace(0,5,500)';
85-
% We want only frequencies until f = 20000Hz
86-
idx = find(f>20000,1);
87-
f = f(1:idx);
88-
S = zeros(size(f));
89-
% Get the result for all frequencies
90-
for ii = 1:length(f)
91-
if showprogress, progress_bar(ii,length(f)); end
92-
[D, x0] = driving_function_mono_localwfs(x0_real,xs,src,f(ii),conf);
93-
% Calculate sound field at the listener position
94-
P = sound_field_mono(X(1),X(2),X(3),x0,greens_function,D,f(ii),conf);
95-
S(ii) = abs(P);
96-
end
97-
98-
% Return parameter
99-
if nargout>0, varargout{1}=S; end
100-
if nargout>1, varargout{2}=f; end
101-
102-
103-
%% ===== Plotting ========================================================
104-
if nargout==0 || useplot
105-
figure;
106-
figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit);
107-
semilogx(f,db(S));
108-
set(gca,'XTick',[10 100 250 1000 5000 20000]);
109-
ylabel('Amplitude (dB)');
110-
xlabel('Frequency (Hz)');
111-
end
52+
% http://sfstoolbox.org sfstoolbox@gmail.com *
53+
%*****************************************************************************
54+
55+
56+
%% ===== Checking of input parameters ==================================
57+
nargmin = 4;
58+
nargmax = 4;
59+
narginchk(nargmin,nargmax);
60+
isargposition(X);
61+
isargxs(xs);
62+
isargchar(src);
63+
isargstruct(conf);
64+
65+
66+
%% ===== Configuration ==================================================
67+
% Plotting result
68+
useplot = conf.plot.useplot;
69+
showprogress = conf.showprogress;
70+
% Disable progress bar for sound field function
71+
conf.showprogress = false;
72+
% Check type of secondary sources to use
73+
if strcmp('2D',conf.dimension)
74+
greens_function = 'ls';
75+
else
76+
greens_function = 'ps';
77+
end
78+
79+
80+
%% ===== Computation ====================================================
81+
% Get the position of the loudspeakers
82+
x0_real = secondary_source_positions(conf);
83+
% Generate frequencies (10^0-10^5)
84+
f = logspace(0,5,500)';
85+
% We want only frequencies until f = 20000Hz
86+
idx = find(f>20000,1);
87+
f = f(1:idx);
88+
S = zeros(size(f));
89+
% Get the result for all frequencies
90+
for ii = 1:length(f)
91+
if showprogress, progress_bar(ii,length(f)); end
92+
[D, x0] = driving_function_mono_localwfs(x0_real,xs,src,f(ii),conf);
93+
% Calculate sound field at the listener position
94+
P = sound_field_mono(X(1),X(2),X(3),x0,greens_function,D,f(ii),conf);
95+
S(ii) = abs(P);
96+
end
97+
98+
% Return parameter
99+
if nargout>0, varargout{1}=S; end
100+
if nargout>1, varargout{2}=f; end
101+
102+
103+
%% ===== Plotting ========================================================
104+
if nargout==0 || useplot
105+
figure;
106+
figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit);
107+
semilogx(f,db(S));
108+
set(gca,'XTick',[10 100 250 1000 5000 20000]);
109+
ylabel('Amplitude (dB)');
110+
xlabel('Frequency (Hz)');
111+
end

SFS_analysis/freq_response_nfchoa.m

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
function varargout = freq_response_nfchoa(X,xs,src,conf)
2-
%FREQ_RESPONSE_NFCHOA simulates the frequency response for NFC-HOA at the given
3-
%listener position
4-
%
5-
% Usage: [S,f] = freq_response_nfchoa(X,xs,src,conf)
6-
%
7-
% Input parameters:
8-
% X - listener position / m
9-
% xs - position of virtual source / m
10-
% src - source type of the virtual source
11-
% 'pw' -plane wave
12-
% 'ps' - point source
13-
% 'fs' - focused source
14-
% conf - configuration struct (see SFS_config)
15-
%
16-
% Output parameters:
17-
% S - simulated frequency response
18-
% f - corresponding frequency axis / Hz
19-
%
20-
% FREQ_RESPONSE_NFCHOA(X,xs,src,conf) simulates the frequency response of the
21-
% sound field at the given position X. The sound field is simulated for the
22-
% given source type (src) using a monochromatic NFC-HOA driving function.
23-
%
24-
% See also: sound_field_mono_nfchoa, sound_field_imp_nfchoa
25-
26-
%*****************************************************************************
1+
function varargout = freq_response_nfchoa(X,xs,src,conf)
2+
%FREQ_RESPONSE_NFCHOA simulates the frequency response for NFC-HOA at the given
3+
%listener position
4+
%
5+
% Usage: [S,f] = freq_response_nfchoa(X,xs,src,conf)
6+
%
7+
% Input parameters:
8+
% X - listener position / m
9+
% xs - position of virtual source / m
10+
% src - source type of the virtual source
11+
% 'pw' -plane wave
12+
% 'ps' - point source
13+
% 'fs' - focused source
14+
% conf - configuration struct (see SFS_config)
15+
%
16+
% Output parameters:
17+
% S - simulated frequency response
18+
% f - corresponding frequency axis / Hz
19+
%
20+
% FREQ_RESPONSE_NFCHOA(X,xs,src,conf) simulates the frequency response of the
21+
% sound field at the given position X. The sound field is simulated for the
22+
% given source type (src) using a monochromatic NFC-HOA driving function.
23+
%
24+
% See also: sound_field_mono_nfchoa, sound_field_imp_nfchoa
25+
26+
%*****************************************************************************
2727
% The MIT License (MIT) *
2828
% *
2929
% Copyright (c) 2010-2016 SFS Toolbox Team *
@@ -49,64 +49,64 @@
4949
% The SFS Toolbox allows to simulate and investigate sound field synthesis *
5050
% methods like wave field synthesis or higher order ambisonics. *
5151
% *
52-
% http://sfstoolbox.org sfstoolbox@gmail.com *
53-
%*****************************************************************************
54-
55-
56-
%% ===== Checking of input parameters ==================================
57-
nargmin = 4;
58-
nargmax = 4;
59-
narginchk(nargmin,nargmax);
60-
isargposition(X);
61-
isargxs(xs);
62-
isargchar(src);
63-
isargstruct(conf);
64-
65-
66-
%% ===== Configuration ==================================================
67-
% Plotting result
68-
useplot = conf.plot.useplot;
69-
% Progress bar
70-
showprogress = conf.showprogress;
71-
% Disable for sound field function
72-
conf.showprogress = false;
73-
% Check type of secondary sources to use
74-
if strcmp('2D',conf.dimension)
75-
greens_function = 'ls';
76-
else
77-
greens_function = 'ps';
78-
end
79-
80-
81-
%% ===== Computation ====================================================
82-
% Get the position of the loudspeakers
83-
x0 = secondary_source_positions(conf);
84-
% Generate frequencies (10^0-10^5)
85-
f = logspace(0,5,500)';
86-
% We want only frequencies until f = 20000Hz
87-
idx = find(f>20000,1);
88-
f = f(1:idx);
89-
S = zeros(size(f));
90-
% Get the result for all frequencies
91-
for ii = 1:length(f)
92-
if showprogress, progress_bar(ii,length(f)); end
93-
D = driving_function_mono_nfchoa(x0,xs,src,f(ii),conf);
94-
% Calculate sound field at the listener position
95-
P = sound_field_mono(X(1),X(2),X(3),x0,greens_function,D,f(ii),conf);
96-
S(ii) = abs(P);
97-
end
98-
99-
% Return parameter
100-
if nargout>0, varargout{1}=S; end
101-
if nargout>1, varargout{2}=f; end
102-
103-
104-
%% ===== Plotting ========================================================
105-
if nargout==0 || useplot
106-
figure;
107-
figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit);
108-
semilogx(f,db(S));
109-
set(gca,'XTick',[10 100 250 1000 5000 20000]);
110-
ylabel('Amplitude (dB)');
111-
xlabel('Frequency (Hz)');
112-
end
52+
% http://sfstoolbox.org sfstoolbox@gmail.com *
53+
%*****************************************************************************
54+
55+
56+
%% ===== Checking of input parameters ==================================
57+
nargmin = 4;
58+
nargmax = 4;
59+
narginchk(nargmin,nargmax);
60+
isargposition(X);
61+
isargxs(xs);
62+
isargchar(src);
63+
isargstruct(conf);
64+
65+
66+
%% ===== Configuration ==================================================
67+
% Plotting result
68+
useplot = conf.plot.useplot;
69+
% Progress bar
70+
showprogress = conf.showprogress;
71+
% Disable for sound field function
72+
conf.showprogress = false;
73+
% Check type of secondary sources to use
74+
if strcmp('2D',conf.dimension)
75+
greens_function = 'ls';
76+
else
77+
greens_function = 'ps';
78+
end
79+
80+
81+
%% ===== Computation ====================================================
82+
% Get the position of the loudspeakers
83+
x0 = secondary_source_positions(conf);
84+
% Generate frequencies (10^0-10^5)
85+
f = logspace(0,5,500)';
86+
% We want only frequencies until f = 20000Hz
87+
idx = find(f>20000,1);
88+
f = f(1:idx);
89+
S = zeros(size(f));
90+
% Get the result for all frequencies
91+
for ii = 1:length(f)
92+
if showprogress, progress_bar(ii,length(f)); end
93+
D = driving_function_mono_nfchoa(x0,xs,src,f(ii),conf);
94+
% Calculate sound field at the listener position
95+
P = sound_field_mono(X(1),X(2),X(3),x0,greens_function,D,f(ii),conf);
96+
S(ii) = abs(P);
97+
end
98+
99+
% Return parameter
100+
if nargout>0, varargout{1}=S; end
101+
if nargout>1, varargout{2}=f; end
102+
103+
104+
%% ===== Plotting ========================================================
105+
if nargout==0 || useplot
106+
figure;
107+
figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit);
108+
semilogx(f,db(S));
109+
set(gca,'XTick',[10 100 250 1000 5000 20000]);
110+
ylabel('Amplitude (dB)');
111+
xlabel('Frequency (Hz)');
112+
end

0 commit comments

Comments
 (0)