forked from jdonley/MSR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSR.m
62 lines (49 loc) · 1.59 KB
/
MSR.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
function result = MSR(res, f, R, N, Wb, Wq, Wu, rb, angb, disb, PWangb, rq, angq, disq, L, Rl, fmax, phi, phiL)
fprintf('\n\nRunning MSR...\n\n');
%%
c = 343;
k = (f/c)*2*pi;
M = ceil(k*R);
kmax = (fmax/c)*2*pi;
Mmax = ceil(kmax*R);
%%
quiet = Orthogonal_Basis_Expansion.spatial_zone(f, 0, rq, 'quiet');
bright = Orthogonal_Basis_Expansion.spatial_zone(f, 0, rb, 'pw', 1.0, PWangb);
quiet.res = res;
bright.res = quiet.res;
quiet = quiet.setDesiredSoundfield(true, 'suppress_output');
bright = bright.setDesiredSoundfield(true, 'suppress_output');
%%
soundfield = Orthogonal_Basis_Expansion.multizone_soundfield_OBE;
soundfield = soundfield.addSpatialZone(quiet, disq, angq);
soundfield = soundfield.addSpatialZone(bright, disb, angb);
soundfield.Radius = R;
soundfield.BrightZ_Weight = Wb;
soundfield.QuietZ_Weight = Wq;
soundfield.UnattendedZ_Weight = Wu;
if N < 1
N = 2*M + 1;
end
soundfield = soundfield.setN( floor(N) );
soundfield = soundfield.createSoundfield('DEBUG', R);
%%
setup = Speaker_Setup.loudspeaker_setup;
setup = setup.addMultizone_Soundfield(soundfield);
setup.Speaker_Arc_Angle = phiL;
setup.Angle_FirstSpeaker = phi;
if L < 1
L = ceil( setup.Speaker_Arc_Angle/360 * 2*Mmax + 1 );
end
setup.Loudspeaker_Count = floor(L);
setup = setup.setRadius( Rl );
setup = setup.calc_Loudspeaker_Weights();
setup = setup.reproduceSoundfield('DEBUG');
%%
figH = figure(...
'name' , 'Multizone Soundfield', ...
'visible' , 'on');
realistic = false;
setup.plotSoundfield( setup.Soundfield_reproduced, 'default', realistic);
result = webfigure(figH);
close(figH);
end