@@ -53,51 +53,54 @@ Before showing the different geometries, we start with some common settings. Fir
5353and set the array size/diameter to 3m.
5454
5555``` Matlab
56- conf = SFS_config ;
56+ conf = SFS_config_example ;
5757conf.secondary_sources.size = 3;
5858```
5959
6060#### linear array
6161
6262``` Matlab
63+ conf = SFS_config_example;
6364conf.secondary_sources.geometry = 'line'; % or 'linear'
6465conf.secondary_sources.number = 21;
6566x0 = secondary_source_positions(conf);
6667figure;
6768figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit);
68- draw_loudspeakers(x0);
69+ draw_loudspeakers(x0,[1 1 0],conf );
6970axis([-2 2 -2 1]);
70- print_png('img/secondary_sources_linear.png');
71+ % print_png('img/secondary_sources_linear.png');
7172```
7273
7374![ Image] ( doc/img/secondary_sources_linear.png )
7475
7576#### circular array
7677
7778``` Matlab
79+ conf = SFS_config_example;
7880conf.secondary_sources.geometry = 'circle'; % or 'circular'
7981conf.secondary_sources.number = 56;
8082x0 = secondary_source_positions(conf);
8183figure;
82- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
83- draw_loudspeakers(x0);
84+ figsize(540,404,'px' );
85+ draw_loudspeakers(x0,[1 1 0],conf );
8486axis([-2 2 -2 2]);
85- print_png('img/secondary_sources_circle.png');
87+ % print_png('img/secondary_sources_circle.png');
8688```
8789
8890![ Image] ( doc/img/secondary_sources_circle.png )
8991
9092#### box shaped array
9193
9294``` Matlab
95+ conf = SFS_config_example;
9396conf.secondary_sources.geometry = 'box';
9497conf.secondary_sources.number = 84;
9598x0 = secondary_source_positions(conf);
9699figure;
97- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
98- draw_loudspeakers(x0);
100+ figsize(540,404,'px' );
101+ draw_loudspeakers(x0,[0 0 1],conf );
99102axis([-2 2 -2 2]);
100- print_png('img/secondary_sources_box.png');
103+ % print_png('img/secondary_sources_box.png');
101104```
102105
103106![ Image] ( doc/img/secondary_sources_box.png )
@@ -117,14 +120,17 @@ download the whole [data repository](http://github.com/sfstoolbox/data) to the
117120<code >data</code > folder.
118121
119122``` Matlab
123+ conf = SFS_config_example;
124+ conf.secondary_sources.size = 3;
120125conf.secondary_sources.geometry = 'sphere'; % or 'spherical'
126+ conf.secondary_sources.grid = 'equally_spaced_points';
121127conf.secondary_sources.number = 225;
122128x0 = secondary_source_positions(conf);
123129figure;
124- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
125- draw_loudspeakers(x0);
130+ figsize(540,404,'px' );
131+ draw_loudspeakers(x0,[1 1 0],conf );
126132axis([-2 2 -2 2]);
127- print_png('img/secondary_sources_sphere.png');
133+ % print_png('img/secondary_sources_sphere.png');
128134```
129135
130136![ Image] ( doc/img/secondary_sources_sphere.png )
@@ -143,6 +149,7 @@ the sound field from the given driving signals and secondary sources. For WFS
143149the <code >r^2 cos(theta)</code > weights for integration on a sphere.
144150
145151``` Matlab
152+ conf = SFS_config_example;
146153% create a stadium like shape by combining two half circles with two linear
147154% arrays
148155% first getting a full circle with 56 loudspeakers
@@ -177,10 +184,10 @@ conf.secondary_sources.x0 = [x01; x02; x03; x04];
177184% simply return the defined x0 matrix
178185x0 = secondary_source_positions(conf);
179186figure;
180- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
181- draw_loudspeakers(x0);
187+ figsize(540,404,'px' );
188+ draw_loudspeakers(x0,[1 1 0],conf );
182189axis([-2 2 -2.5 2.5]);
183- print_png('img/secondary_sources_arbitrary.png');
190+ % print_png('img/secondary_sources_arbitrary.png');
184191```
185192
186193![ Image] ( doc/img/secondary_sources_arbitrary.png )
@@ -194,10 +201,10 @@ symbols, for example the following will replot the last array.
194201``` Matlab
195202conf.plot.realloudspeakers = true;
196203figure;
197- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
204+ figsize(540,404,'px' );
198205draw_loudspeakers(x0,conf);
199206axis([-2 2 -2.5 2.5]);
200- print_png('img/secondary_sources_arbitrary_realloudspeakers.png');
207+ % print_png('img/secondary_sources_arbitrary_realloudspeakers.png');
201208```
202209
203210![ Image] ( doc/img/secondary_sources_arbitrary_realloudspeakers.png )
@@ -226,18 +233,18 @@ The following will simulate the field of a virtual plane wave with a frequency
226233of 800 Hz going into the direction of (0 -1 0) synthesized with 3D WFS.
227234
228235``` Matlab
229- conf = SFS_config ;
236+ conf = SFS_config_example ;
230237conf.dimension = '3D';
231238conf.secondary_sources.size = 3;
232239conf.secondary_sources.number = 225;
233240conf.secondary_sources.geometry = 'sphere';
234241% [P,x,y,z,x0,win] = sound_field_mono_wfs(X,Y,Z,xs,src,f,conf);
235242sound_field_mono_wfs([-2 2],[-2 2],0,[0 -1 0],'pw',800,conf);
236- print_png('img/sound_field_wfs_3d_xy.png');
243+ % print_png('img/sound_field_wfs_3d_xy.png');
237244sound_field_mono_wfs([-2 2],0,[-2 2],[0 -1 0],'pw',800,conf);
238- print_png('img/sound_field_wfs_3d_xz.png');
245+ % print_png('img/sound_field_wfs_3d_xz.png');
239246sound_field_mono_wfs(0,[-2 2],[-2 2],[0 -1 0],'pw',800,conf);
240- print_png('img/sound_field_wfs_3d_yz.png');
247+ % print_png('img/sound_field_wfs_3d_yz.png');
241248```
242249
243250![ Image] ( doc/img/sound_field_wfs_3d_xy.png )
@@ -258,12 +265,12 @@ have to explicitly say if we want also plot the results, by
258265<code >conf.plot.useplot = true;</code >.
259266
260267``` Matlab
261- conf = SFS_config ;
268+ conf = SFS_config_example ;
262269conf.dimension = '2.5D';
263270conf.plot.useplot = 1;
264271% [P,x,y,z,x0] = sound_field_mono_wfs(X,Y,Z,xs,src,f,conf);
265272[P,x,y,z,x0] = sound_field_mono_wfs([-2 2],[-2 2],0,[0 2.5 0],'ps',800,conf);
266- print_png('img/sound_field_wfs_25d.png');
273+ % print_png('img/sound_field_wfs_25d.png');
267274```
268275
269276![ Image] ( doc/img/sound_field_wfs_25d.png )
@@ -281,7 +288,7 @@ x0_all = secondary_source_positions(conf);
281288x0_all(:,7) = zeros(1,size(x0_all,1));
282289x0_all(idx,7) = x0(:,7);
283290plot_sound_field(P,x,y,z,x0_all,conf);
284- print_png('img/sound_field_wfs_25d_with_all_sources.png');
291+ % print_png('img/sound_field_wfs_25d_with_all_sources.png');
285292```
286293
287294![ Image] ( doc/img/sound_field_wfs_25d_with_all_sources.png )
@@ -293,11 +300,11 @@ In the following we will simulate the field of a virtual plane wave with a frequ
293300of 800 Hz traveling into the direction (0 -1 0), synthesized with 2.5D NFC-HOA.
294301
295302``` Matlab
296- conf = SFS_config ;
303+ conf = SFS_config_example ;
297304conf.dimension = '2.5D';
298305% sound_field_mono_nfchoa(X,Y,Z,xs,src,f,conf);
299306sound_field_mono_nfchoa([-2 2],[-2 2],0,[0 -1 0],'pw',800,conf);
300- print_png('img/sound_field_nfchoa_25d.png');
307+ % print_png('img/sound_field_nfchoa_25d.png');
301308```
302309
303310![ Image] ( doc/img/sound_field_nfchoa_25d.png )
@@ -311,10 +318,11 @@ single secondary sources to the resulting sound field. With these function you
311318can for example easily simulate a stereophonic setup.
312319
313320``` Matlab
321+ conf = SFS_config_example;
314322x0 = [-1 2 0 0 -1 0 1;1 2 0 0 -1 0 1];
315323% [P,x,y,z] = sound_field_mono(X,Y,Z,x0,src,D,f,conf)
316- sound_field_mono([-2 2],[-1 3],0,x0,'ps',[1 1],800)
317- print_png('img/sound_field_stereo.png');
324+ sound_field_mono([-2 2],[-1 3],0,x0,'ps',[1 1],800,conf )
325+ % print_png('img/sound_field_stereo.png');
318326```
319327![ Image] ( doc/img/sound_field_stereo.png )
320328
@@ -328,12 +336,12 @@ In the following we will create a snapshot in time after 200 samples for a broad
328336virtual point source placed at (0 2 0) m for 2.5D NFC-HOA.
329337
330338``` Matlab
331- conf = SFS_config ;
339+ conf = SFS_config_example ;
332340conf.dimension = '2.5D';
333341conf.plot.useplot = true;
334342% sound_field_imp_nfchoa(X,Y,Z,xs,src,t,conf)
335343[p,x,y,z,x0] = sound_field_imp_nfchoa([-2 2],[-2 2],0,[0 2 0],'ps',200,conf);
336- print_png('img/sound_field_imp_nfchoa_25d.png');
344+ % print_png('img/sound_field_imp_nfchoa_25d.png');
337345```
338346
339347![ Image] ( doc/img/sound_field_imp_nfchoa_25d.png )
@@ -348,7 +356,7 @@ We change also the color map to the Matlab default one.
348356conf.plot.usedb = true;
349357conf.plot.colormap = 'jet';
350358plot_sound_field(p,x,y,z,x0,conf);
351- print_png('img/sound_field_imp_nfchoa_25d_dB.png');
359+ % print_png('img/sound_field_imp_nfchoa_25d_dB.png');
352360```
353361
354362![ Image] ( doc/img/sound_field_imp_nfchoa_25d_dB.png )
@@ -382,28 +390,28 @@ two available angles will be applied. Afterwards a noise signal is created and c
382390with the impulse response by the <code >auralize_ir()</code > function.
383391
384392``` Matlab
385- conf = SFS_config ;
386- irs = read_irs('QU_KEMAR_anechoic_3m.mat');
393+ conf = SFS_config_example ;
394+ irs = read_irs('QU_KEMAR_anechoic_3m.mat',conf );
387395ir = get_ir(irs,[rad(30) 0 3]);
388396nsig = randn(44100,1);
389- sig = auralize_ir(ir,nsig);
397+ sig = auralize_ir(ir,nsig,1,conf );
390398sound(sig,conf.fs);
391399```
392400
393401To simulate the same source as a virtual point source synthesized by WFS and a
394402circular array with a diameter of 3 m, you have to do the following.
395403
396404``` Matlab
397- conf = SFS_config ;
405+ conf = SFS_config_example ;
398406conf.secondary_sources.size = 3;
399407conf.secondary_sources.number = 56;
400408conf.secondary_sources.geometry = 'circle';
401409conf.dimension = '2.5D';
402- irs = read_irs('QU_KEMAR_anechoic_3m.mat');
410+ irs = read_irs('QU_KEMAR_anechoic_3m.mat',conf );
403411% ir = ir_wfs(X,phi,xs,src,irs,conf);
404412ir = ir_wfs([0 0 0],pi/2,[0 3 0],'ps',irs,conf);
405413nsig = randn(44100,1);
406- sig = auralize_ir(ir,nsig);
414+ sig = auralize_ir(ir,nsig,1,conf );
407415```
408416
409417Binaural simulations are also a nice way to investigate the frequency response
@@ -414,25 +422,25 @@ expected aliasing frequency of the system (above these frequency the spectrum
414422becomes very noise as you can see in the figure).
415423
416424``` Matlab
417- conf = SFS_config ;
425+ conf = SFS_config_example ;
418426conf.ir.usehcomp = 0;
419427conf.wfs.usehpre = 0;
420428irs = dummy_irs;
421429[ir1,x0] = ir_wfs([0 0 0],pi/2,[0 2.5 0],'ps',irs,conf);
422430conf.wfs.usehpre = 1;
423- conf.wfs.hprefhigh = aliasing_frequency(x0);
431+ conf.wfs.hprefhigh = aliasing_frequency(x0,conf );
424432ir2 = ir_wfs([0 0 0],pi/2,[0 2.5 0],'ps',irs,conf);
425- [a1,p,f] = easyfft(ir1(:,1)./max(abs(ir1(:,1))));
426- a2 = easyfft(ir2(:,1)./max(abs(ir2(:,1))));
433+ [a1,p,f] = easyfft(ir1(:,1)./max(abs(ir1(:,1))),conf );
434+ a2 = easyfft(ir2(:,1)./max(abs(ir2(:,1))),conf );
427435figure;
428- figsize(conf.plot.size(1),conf.plot.size(2),conf.plot.size_unit );
436+ figsize(540,404,'px' );
429437semilogx(f,20*log10(a1),'-b',f,20*log10(a2),'-r');
430438axis([10 20000 -80 -40]);
431439set(gca,'XTick',[10 100 250 1000 5000 20000]);
432440legend('w/o pre-filter','w pre-filter');
433441xlabel('frequency / Hz');
434442ylabel('magnitude / dB');
435- print_png('img/impulse_response_wfs_25d.png');
443+ % print_png('img/impulse_response_wfs_25d.png');
436444```
437445
438446![ Image] ( doc/img/impulse_response_wfs_25d.png )
@@ -443,7 +451,8 @@ frequency range will be affected.
443451
444452``` Matlab
445453freq_response_wfs([0 0 0],[0 2.5 0],'ps',conf);
446- print_png('img/impulse_response_wfs_25d_mono.png');
454+ axis([10 20000 -20 20]);
455+ %print_png('img/impulse_response_wfs_25d_mono.png');
447456```
448457
449458![ Image] ( doc/img/impulse_response_wfs_25d_mono.png )
@@ -460,6 +469,7 @@ responses used by the SoundScape Renderer.
460469All functions regarding the SSR are stored in <code >SFS_ssr</code >.
461470
462471``` Matlab
472+ conf = SFS_config_example;
463473brs = ssr_brs_wfs(X,phi,xs,src,irs,conf);
464474wavwrite(brs,fs,16,'brs_set_for_SSR.wav');
465475```
@@ -490,7 +500,7 @@ you cannot do the plotting to png afterwards like in Matlab, but have to specify
490500the output file before. Note, that the same will work with Matlab.
491501
492502``` Matlab
493- conf = SFS_config ;
503+ conf = SFS_config_example ;
494504conf.plot.colormap = 'gray';
495505conf.plot.usegnuplot = 1;
496506conf.plot.file = 'img/sound_field_nfchoa_25d_gnuplot.png';
0 commit comments