forked from sfstoolbox/sfs-matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SFS_config_example.m
241 lines (217 loc) · 9.51 KB
/
SFS_config_example.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
function conf = SFS_config()
%SFS_CONFIG Configuration file for the SoundFieldSynthesis functions
%
% Usage: conf = SFS_config
%
% Output parameters:
% conf - struct containing all configuration variables
%
% SFS_CONFIG() creates the struct conf containing the default
% configuration values. If you want to create other entries, please set
% them in your script (e.g. conf.fs = 48000) and pass the conf struct to
% the desired function as last input (e.g. tapering_window(x0,conf)).
%
% So edit this function only, if the default values have changed!
%
% see also: SFS_start
%*****************************************************************************
% Copyright (c) 2010-2013 Quality & Usability Lab, together with *
% Assessment of IP-based Applications *
% Deutsche Telekom Laboratories, TU Berlin *
% Ernst-Reuter-Platz 7, 10587 Berlin, Germany *
% *
% Copyright (c) 2013 Institut für Nachrichtentechnik *
% Universität 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:https://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:https://dev.qu.tu-berlin.de/projects/sfs-toolbox [email protected] *
%*****************************************************************************
%% ===== Checking of input parameters ==================================
nargmin = 0;
nargmax = 0;
error(nargchk(nargmin,nargmax,nargin));
%% ===== Configuration default values ===================================
% ===== Table of Content ========================
%
% - Misc
% - Audio
% - Simulations
% - Secondary Sources
% - Binaural Reproduction
% * Headphone compensation
% * HRIR/BRIR
% * Auralization
% - WFS
% * Pre-equalization
% * Tapering
% * Virtual Sources
% - SDM
% - HOA
% - Plotting
% * Gnuplot
%
% ===== Misc ====================================
conf.tmpdir = '/tmp/sfs';
% Debugging level. We are supporting 3 levels:
% 0 - normal mode
% 1 - debug modus, showing interim results and plots
conf.debug = 0;
% ===== Audio ===================================
% Samplingrate
conf.fs = 44100; % Hz
% Speed of sound
conf.c = 343; % m/s
% use fractional delays for delay lines
conf.usefracdelay = 0;
conf.fracdelay_method = 'resample';
% ===== Simulations =============================
% xyresolution for wavefield simulations
conf.xysamples = 300; % samples
% Phase of omega of wavefield (change this value to create monochromatic wave
% fields with different phases for a movie)
conf.phase = 0; % rad
% Time frame to simulate for wave field in time domain (change this value to
% create impulse response movies of the wave field
conf.frame = 1000;
% ===== Secondary Sources =======================
% Interspacing (distance) between the secondary sources
conf.dx0 = 0.15; % m
% Array position
conf.X0 = [0 0 0]; % m
% Array geometry
% Possible values are: 'linear', 'box', 'circle', 'U', 'custom'
conf.array = 'linear';
% Vector containing custom secondary source positions and directions.
% conf.x0 = [x0; y0; z0; phi];
conf.x0 = []; % m; m; m; rad
% ===== Binaural reproduction ===================
%
% === Headphone compensation ===
% Headphone compensation
conf.usehcomp = true; % boolean
% Headphone compensation file for left and right ear.
conf.hcomplfile = ...
'~/data/ir_databases/headphone_compensations/TU_FABIAN_AKGK601_hcompl.wav';
conf.hcomprfile = ...
'~/data/ir_databases/headphone_compensations/TU_FABIAN_AKGK601_hcompr.wav';
%
% === HRIR/BRIR ===
% Target length of BRIR impulse responses (2^14 may be enough for your
% purposes, but for a large distance between source and listener, this will
% be not enough to contain the desired time delay. But don't worry, SFS
% checks for you if conf.N is large enough)
conf.N = 2^15; % samples
% To use a dynamic binaural simulation together with the SoundScape Renderer
% (SSR) and a headtracker, brs sets can be created. If these sets should be
% used in BRS mode of the SSR, the angles have to be:
% conf.brsangles = 0:1:359;
% If the brs set should be used as IRs for the SSR, the angles have to be:
% conf.brsangles = 360:-1:1;
conf.brsangles = 0:1:359; % degree
%
% === Auralisation ===
% These files are used for the auralization of impulse responses by the
% auralize_ir() function.
% NOTE: you have to provide them by yourself!
conf.speechfile = '';
conf.cellofile = '';
conf.castanetsfile = '';
conf.noisefile = '';
conf.pinknoisefile = '';
% ===== WFS =====================================
% The amplitude will be correct at the point xref for 2.5D
% synthesis.
% Thi point is also used to scale the wave field to 1 at this point.
conf.xref = [0 2 0]; % m, m, m
%
% ===== Pre-Equalization =====
% WFS can be implemented very efficiently using a delay-line with different
% amplitudes and convolving the whole signal once with the so called
% pre-equalization filter [References]. If we have aliasing in our system we
% only want to use the pre-equalization filter until the aliasing frequency,
% because of the energy the aliasing is adding to the spectrum above this
% frequency (which means the frequency response over the aliasing frequency is
% allready "correct") [Reference]
% Use WFS preequalization-filter
conf.usehpre = false; % boolean
% Lower frequency limit of preequalization filter (~ frequency when
% subwoofer is active)
conf.hpreflow = 50; % Hz
% Upper frequency limit of preequalization filter (~ aliasing frequency of
% system)
conf.hprefhigh = 1200; % Hz
%
% ===== Tapering =====
% The truncation of the loudspeaker array leads to diffraction of the
% synthesized wave field. It has been shown that the truncation can be discribed
% by cylindrical waves originating from the edges of the array
% [Young,Sommerfeld,Rubinovitch]. Therefore a good method to reduce artifacts
% due to the diffraction edge waves is to fade out the amplitude of the driving
% function at the edges of the array. This method is called tapering and
% implemented using a Hanning window.
% Use tapering window
conf.usetapwin = true; % boolean
% Size of the tapering window
conf.tapwinlen = 0.3; % percent of array length 0..1
%
% === Virtual Sources ===
% Pre-delay for causality for focused sources
% Note: for a non focused point source this will be set automaticly to 0
% from brs_wfs_25d!
conf.t0 = -3*1024/conf.fs; % s
% ===== SDM =====================================
% Use the evanescent part of the driving function for SDM
conf.withev = true; % boolean
% ===== HOA =====================================
% TODO
% ===== Plotting ================================
% Plot the results (wave fields etc.) directly
conf.useplot = false; % boolean
% Plot mode (uses the GraphDefaults function). Avaiable modes are:
% 'monitor' - displays the plot on the monitor
% 'paper' - eps output in conf.plot.outfile
% 'png' - png output in conf.plot.outfile
conf.plot.mode = 'monitor';
% Plot amplitudes in dB (e.g. wavefield plots)
conf.plot.usedb = false; % boolean
% caxis settings (leave blank, if you would use the default values of the given
% plot function)
conf.plot.caxis = '';
% Default colormap to use (note this works only with Matlab at the moment)
conf.plot.colormap = 'gray'; % (default: 'gray')
% Plot loudspeakers in the wave field plots
conf.plot.loudspeakers = true; % boolean
% Use real loudspeakers symbols (otherwise crosses are used)
conf.plot.realloudspeakers = true; % boolean
% Size of the loudspeaker
conf.plot.lssize = conf.dx0; % m
% Size of the plot
conf.plot.size = [16,11.55]; % cm
% Additional plot command
conf.plot.cmd = '';
% output of plot (file or screen)
conf.plot.usefile = 0;
conf.plot.file = 'sfs';
%
% === Gnuplot ===
% Use gnuplot
conf.plot.usegnuplot = false; % boolean