-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdma.m
25 lines (24 loc) · 883 Bytes
/
dma.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
%differential microfone array
%from Teutsch and Elko, "First- and Second-Order Adaptive Differential
%Microphone Arrays"
%takes signals of two omnidirectional microphones and combines them to one
%signal with a zero a certain angle
function sigVecNew = dma(options,sigVec)
angle = options.dma.angle/180*pi;
frequencies = options.frequency;
%k = 2*pi*frequencies/options.c;
c = options.c;
%calculate distance of microphones
d = sqrt(sum(options.geometry(:,1).^2) + sum(options.geometry(:,2).^2));
%calculate delay in time domain
T = -d/c*cos(angle);
%calculate delay in frequency domain
%delay = exp(-i*(2*pi*frequencies*T+k*d));
delay = exp(-i*(2*pi*frequencies*T));
%calculate filter
filtCoeff = 1./(2*pi*frequencies);
%calculate output signal
%keyboard
sigVecNew = zeros(size(sigVec));
sigVecNew(2,:) = sigVec(1,:);
sigVecNew(1,:) = filtCoeff .* (sigVec(1,:)-delay.*sigVec(2,:));