Forráskód Böngészése

sphear_common: pad signal with trailing zeroes to let the fir filter ring, use twice the size of the fir filter

Fernando Pablo Lopez-Lezcano 9 éve
szülő
commit
fbc09beef5
1 módosított fájl, 3 hozzáadás és 2 törlés
  1. 3 2
      calibration/src/sphear_common.m

+ 3 - 2
calibration/src/sphear_common.m

@@ -1,3 +1,4 @@
+%% -*- mode: octave -*-
 %%
 %% *SpHEAR Project
 %%
@@ -28,7 +29,6 @@ pkg load signal;
 %%
 %% m: number of measurement to render
 %% FIR: matrix of A2B FIR filters
-%% range: range of samples to process in file
 %% Nfft: size of FFT to use
 
 function [bf] = sphear_a_to_b(m, FIR, Nfft);
@@ -37,7 +37,8 @@ function [bf] = sphear_a_to_b(m, FIR, Nfft);
   for c = 1:4
     cs(c,:) = wavread(["../data/current/af/a-format-0" sprintf("%02.0f", m) "-" char(capnames(c)) ".wav"]);
     for b = 1:4
-      bs(c,b,:) = fftfilt(reshape(FIR(b,c,:), 1, [])', cs(c,:), Nfft);
+      %% we add trailing zeros to let the filter ring
+      bs(c,b,:) = fftfilt(reshape(FIR(b,c,:), 1, [])', cat(1, cs(c,:)', zeros(2*size(FIR(1,1,:))(3),1))', Nfft);
     end
   end
   %% add filtered capsule output to b format components