Quellcode durchsuchen

add sphear_fir_design.m, design a matrix of FIR filters that makes up the A2B matrix

Fernando Pablo Lopez-Lezcano vor 10 Jahren
Ursprung
Commit
11f36731c6
1 geänderte Dateien mit 46 neuen und 0 gelöschten Zeilen
  1. 46 0
      sphear_fir_design.m

+ 46 - 0
sphear_fir_design.m

@@ -0,0 +1,46 @@
+%%
+%% *SpHEAR Project
+%%
+%% sphear_fir_design: design a matrix of FIR filters that equalizes the microphone
+%%
+%% usage:
+%%   [FIR] = sphear_fir_design(F, A2BF, n, Fs)
+%%
+%% F: array of filter section center frequencies
+%% A2BF: vector of A2B matrixes
+%% n: order of the FIR filter being created
+%% Fs: sampling rate
+%%
+%% Copyright 2016, Fernando Lopez-Lezcano, All Rights Reserved
+%% nando@ccrma.stanford.edu
+%%
+%%  This program 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.
+%%
+%%  This program 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://www.gnu.org/licenses/>.
+
+function [FIR] = sphear_fir_design(F, A2BF, n, Fs)
+
+  FIR = zeros(4, 4, (n + 1));
+
+  %% frequency range
+  f = [0 F' Fs/2]' / (Fs/2);
+
+  %% all b format components
+  for b = 1:4
+    %% all capsules
+    for c = 1:4
+      r = [ A2BF(1,c,b) A2BF(:,c,b)' A2BF(end,c,b)]';
+      FIR(b, c, :) = fir2(n, f, r);
+    end
+  end
+  
+end