-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfig3.m
88 lines (78 loc) · 2.48 KB
/
fig3.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
clear all
% Listening area
X = [-2 2]; % / m
Y = [-2 2]; % / m
Z = 0;
% virtual source position
xs = [0 -1.5 0]; % / m
% virtual source type
src = 'ps';
% frequency (for mono-frequent plots)
f = 1000; % / Hz
% time (for impulse response plots)
t = 193; % / samples
% === Toolbox settings ===
conf.resolution = 1000; % / samples
conf.xref = [0 0 0]; % / m
conf.fs = 44100; % / Hz
conf.c = 343; % / m/s
conf.phase = 0; % / rad
conf.usenormalisation = true;
conf.plot.useplot = false;
conf.showprogress = false;
conf.debug = 0;
conf.tmpdir = '';
conf.usebandpass = false;
conf.bandpassflow = 10; % / Hz
conf.bandpassfhigh = 20000; % / Hz
conf.plot.useplot = false; % boolean
conf.plot.mode = 'monitor';
conf.plot.loudspeakers = true; % boolean
conf.plot.realloudspeakers = true; % boolean
conf.plot.lssize = 0.16; % m
conf.plot.size_unit = 'px'; % 'px','cm','inches'
conf.plot.size = [540 404];
conf.plot.resolution = 150; % / dpi
conf.plot.cmd = '';
conf.plot.usefile = 0;
conf.plot.file = '';
conf.plot.usegnuplot = false; % boolean
% get all six loudspeakers
conf.secondary_sources.size = 3; % / m
conf.secondary_sources.center = [0 0 0]; % / m
conf.secondary_sources.geometry = 'circle';
conf.secondary_sources.number = 6;
conf.secondary_sources.x0 = [];
x0 = secondary_source_positions(conf);
% === single speaker at virtual source position ==========================
conf.plot.usedb = false;
conf.plot.caxis = [-1 1];
conf.plot.colormap = blueblack(256);
sound_field_mono(X,Y,Z,[xs 0 1 0 1],'ps',1,f,conf);
conf.plot.usedb = true;
conf.plot.caxis = [-45 0];
conf.plot.colormap = whitered(256);
sound_field_imp(X,Y,Z,[xs 0 1 0 1],'ps',1,t,conf);
% === pairwise amplitude panning ========================================
conf.plot.usedb = false;
conf.plot.caxis = [-1 1];
conf.plot.colormap = blueblack(256);
sound_field_mono(X,Y,Z,x0(5:6,:),'ps',[1 1],f,conf);
conf.plot.usedb = true;
conf.plot.caxis = [-45 0];
conf.plot.colormap = whitered(256);
sound_field_imp(X,Y,Z,x0(5:6,:),'ps',[1 1],t,conf);
% === second-order ambisonics amplitude panning ==========================
N = 2;
[phi,theta,r] = cart2sph(x0(:,4),x0(:,5),x0(:,6));
Yc = circular_harmonics(N,phi); % secondary sources
Y0 = circular_harmonics(N,pi/2); % virtual source
D = (Yc'*Y0*2*pi/size(x0,1))';
conf.plot.usedb = false;
conf.plot.caxis = [-1 1];
conf.plot.colormap = blueblack(256);
sound_field_mono(X,Y,Z,x0,'ps',D,f,conf);
conf.plot.usedb = true;
conf.plot.caxis = [-45 0];
conf.plot.colormap = whitered(256);
sound_field_imp(X,Y,Z,x0,'ps',D,t,conf);