Skip to content

Commit

Permalink
Update test validation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Feb 2, 2015
1 parent 22ab8c4 commit bdd0e4a
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 73 deletions.
99 changes: 99 additions & 0 deletions validation/test_impulse_responses.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
function boolean = test_impulse_responses()
%TEST_IMPULSE_RESPONSES tests time behavior of WFS and local WFS
%
% Usage: boolean = test_impulse_responses()
%
% Output parameters:
% booelan - true or false
%
% TEST_IMPULSE_RESPONSES() compares the time-frequency response of
% WFS and local WFS by calculating impulse responses, their frequency
% spectrum, and spatial-temporal sound field.

%*****************************************************************************
% Copyright (c) 2010-2014 Quality & Usability Lab, together with *
% Assessment of IP-based Applications *
% Telekom Innovation Laboratories, TU Berlin *
% Ernst-Reuter-Platz 7, 10587 Berlin, Germany *
% *
% Copyright (c) 2013-2014 Institut fuer Nachrichtentechnik *
% Universitaet Rostock *
% Richard-Wagner-Strasse 31, 18119 Rostock *
% *
% This file is part of the Sound Field Synthesis-Toolbox (SFS). *
% *
% The SFS is free software: you can redistribute it and/or modify it under *
% the terms of the GNU General Public License as published by the Free *
% Software Foundation, either version 3 of the License, or (at your option) *
% any later version. *
% *
% The SFS is distributed in the hope that it will be useful, but WITHOUT ANY *
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
% FOR A PARTICULAR PURPOSE. *
% See the GNU General Public License for more details. *
% *
% You should have received a copy of the GNU General Public License along *
% with this program. If not, see <http://www.gnu.org/licenses/>. *
% *
% The SFS is a toolbox for Matlab/Octave to simulate and investigate sound *
% field synthesis methods like wave field synthesis or higher order *
% ambisonics. *
% *
% http://github.com/sfstoolbox/sfs sfstoolbox@gmail.com *
%*****************************************************************************


%% ===== Configuration ===================================================
boolean = false;
%% Parameters
conf = SFS_config_example;
conf.showprogress = true;
conf.resolution = 400;
conf.plot.useplot = true;
conf.plot.loudspeakers = true;
conf.plot.realloudspeakers = false;
conf.plot.usedb = true;
conf.tapwinlen = 1.0;
% config for virtual array
conf.localsfs.method = 'wfs';
conf.localsfs.wfs = conf.wfs;
conf.localsfs.usetapwin = true;
conf.localsfs.tapwinlen = 0.3;
conf.localsfs.vss.size = 1.0;
conf.localsfs.vss.center = [0, 0.5, 0];
conf.localsfs.vss.geometry = 'linear';
conf.localsfs.vss.number = 56;
conf.localsfs.vss.consider_target_field = true;
conf.localsfs.vss.consider_secondary_sources = true;
% config for real array
conf.dimension = '2.5D';
conf.secondary_sources.geometry = 'linear';
conf.secondary_sources.number = 56;
conf.secondary_sources.size = 3;
conf.secondary_sources.center = [0, 1.5, 0];
conf.driving_functions = 'default';
conf.xref = conf.localsfs.vss.center;
% impulse response
conf.ir.usehcomp = false;
% listening area, virtual source
xs = [0.0, -1.0, 0]; % propagation direction of plane wave
src = 'pw';
X = [-1.5 1.5];
Y = [-1, 1.55];
Z = 0;


%% ===== Computation =====================================================
%% temporal impulse responses
irs = dummy_irs;
% calculate impulse response for WFS and local WFS
s_lwfs = ir_localwfs(conf.xref,pi/2,xs,src,irs,conf);
s_wfs = ir_wfs(conf.xref,pi/2,xs,src,irs,conf);
% plot frequency response
[S_lwfs, ~, f_lwfs] = easyfft(s_lwfs(:,1)./max(abs(s_lwfs(:,1))), conf);
[S_wfs, ~, f_wfs] = easyfft(s_wfs(:,1)./max(abs(s_wfs(:,1))), conf);
% plot spatio-temporal sound field
sound_field_imp_localwfs(X,Y,Z, xs, src, 400, conf);
sound_field_imp_wfs(X,Y,Z, xs, src, 190, conf);

boolean = true;
56 changes: 0 additions & 56 deletions validation/test_impulseresponses.m

This file was deleted.

58 changes: 52 additions & 6 deletions validation/test_localwfs.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,52 @@
%% initialize
clear variables;
function boolean = test_localwfs()
%TEST_LOCALWFS tests the local WFS driving functions
%
% Usage: boolean = test_localwfs()
%
%
% Output parameters:
% booelan - true or false
%
% TEST_LOCALWFS() checks if the local WFS driving functions for the
% monochromatic case are working. Different sound fields are calculated and
% plotted for visual inspection.

%*****************************************************************************
% Copyright (c) 2010-2014 Quality & Usability Lab, together with *
% Assessment of IP-based Applications *
% Telekom Innovation Laboratories, TU Berlin *
% Ernst-Reuter-Platz 7, 10587 Berlin, Germany *
% *
% Copyright (c) 2013-2014 Institut fuer Nachrichtentechnik *
% Universitaet Rostock *
% Richard-Wagner-Strasse 31, 18119 Rostock *
% *
% This file is part of the Sound Field Synthesis-Toolbox (SFS). *
% *
% The SFS is free software: you can redistribute it and/or modify it under *
% the terms of the GNU General Public License as published by the Free *
% Software Foundation, either version 3 of the License, or (at your option) *
% any later version. *
% *
% The SFS is distributed in the hope that it will be useful, but WITHOUT ANY *
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
% FOR A PARTICULAR PURPOSE. *
% See the GNU General Public License for more details. *
% *
% You should have received a copy of the GNU General Public License along *
% with this program. If not, see <http://www.gnu.org/licenses/>. *
% *
% The SFS is a toolbox for Matlab/Octave to simulate and investigate sound *
% field synthesis methods like wave field synthesis or higher order *
% ambisonics. *
% *
% http://github.com/sfstoolbox/sfs sfstoolbox@gmail.com *
%*****************************************************************************

%% Parameters

%% ===== Configuration ===================================================
boolean = false;
% Parameters
conf = SFS_config_example;
conf.plot.useplot = false;
conf.showprogress = true;
Expand All @@ -12,7 +56,7 @@
conf.usetapwin = true;


%% === Circular secondary sources ===
%% ===== Circular secondary sources ======================================
% config for real loudspeaker array
conf.dimension = '2D';
conf.secondary_sources.geometry = 'circular';
Expand Down Expand Up @@ -61,7 +105,7 @@
sound_field_mono_localwfs(xrange, yrange, zrange,xs,src,f,conf)


%% === Linear secondary sources ===
%% ===== Linear secondary sources =======================================
% config for real loudspeaker array
conf.dimension = '2D';
conf.secondary_sources.geometry = 'linear';
Expand Down Expand Up @@ -110,7 +154,7 @@
sound_field_mono_localwfs(xrange, yrange, zrange,xs,src,f,conf)


%% === Box shaped secondary sources ===
%% ===== Box shaped secondary sources ===================================
% config for real loudspeaker array
conf.dimension = '2D';
conf.secondary_sources.geometry = 'box';
Expand Down Expand Up @@ -157,3 +201,5 @@
conf.localsfs.vss.consider_target_field = true;
conf.localsfs.vss.consider_secondary_sources = true;
sound_field_mono_localwfs(xrange, yrange, zrange,xs,src,f,conf)

boolean = true;
5 changes: 3 additions & 2 deletions validation/test_secondary_sources.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
% Usage: boolean = test_secondary_sources(modus)
%
% Input parameters:
% modus - 0: numerical
% 1: visual
% modus - 0: numerical (quiet)
% 1: numerical (verbose)
% 2: visual
%
% Output parameters:
% booelan - true or false
Expand Down
34 changes: 25 additions & 9 deletions validation/test_wfs_iir_prefilter.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
function boolean = test_wfs_iir_prefilter()
%TEST_WFS_IIR_PREFILTER tests the IIR WFS pre-equalization filter
%
% Usage: boolean = test_wfs_iir_prefilter()
%
% Output parameters:
% booelan - true or false
%
% TEST_WFS_IIR_PREFILTER() test the WFS pre-euqalization IIR filter
% design. This works only in Matlab as the Signal Processing Toolbox is used.
% See wfs_iir_prefilter.m for details

%*****************************************************************************
% Copyright (c) 2010-2014 Quality & Usability Lab, together with *
% Assessment of IP-based Applications *
Expand Down Expand Up @@ -31,15 +43,19 @@
%*****************************************************************************


clear all; close all; clc;
%see wfs_iir_prefilter.m for details
SFS_start;
SFS_version

%% ===== Configuration ===================================================
boolean = false;
conf = SFS_config_example;


%% ===== Calculation =====================================================
% call with default values
hpre1 = wfs_iir_prefilter(conf)
conf.fs = 44100;
conf.hpreflow = 200;
conf.hprefhigh = 1500;
conf.hpreBandwidth_in_Oct = 2;
conf.hpreIIRorder = 4;
hpre1 = wfs_iir_prefilter() %call with no conf to test default values
hpre2 = wfs_iir_prefilter(conf) %call with parameters in conf
SFS_stop;
conf.hpreBandwidth_in_Oct = 2;
conf.hpreIIRorder = 4;
hpre2 = wfs_iir_prefilter(conf)
boolean = true;

0 comments on commit bdd0e4a

Please sign in to comment.