|
@@ -96,12 +96,14 @@ function [FIR IR MPS] = sphear_design_fir_filters(F, n, SR, W, X, Y, Z, S, T, U,
|
|
|
%% https://ccrma.stanford.edu/~jos/filters/Conversion_Minimum_Phase.html
|
|
%% https://ccrma.stanford.edu/~jos/filters/Conversion_Minimum_Phase.html
|
|
|
%%
|
|
%%
|
|
|
MPS(b,:) = real(ifft(mps(fft(IR(b,:)))));
|
|
MPS(b,:) = real(ifft(mps(fft(IR(b,:)))));
|
|
|
|
|
+ %% we need to preserve the sign, the minimum phase transformation strips it
|
|
|
|
|
+ sgn = sign(IR(b,round(n/2+1)));
|
|
|
%%
|
|
%%
|
|
|
%% create a raised cosine window for the end of the IR
|
|
%% create a raised cosine window for the end of the IR
|
|
|
%% to make sure IR decays to zero (last 8 samples of a 256 sample IR)
|
|
%% to make sure IR decays to zero (last 8 samples of a 256 sample IR)
|
|
|
end_window = tukeywin(2 * n, 0.025)(n+1:end);
|
|
end_window = tukeywin(2 * n, 0.025)(n+1:end);
|
|
|
%% truncate to original size and window end
|
|
%% truncate to original size and window end
|
|
|
- FIR(b,:) = (MPS(b,:)')(1:n) .* end_window;
|
|
|
|
|
|
|
+ FIR(b,:) = (MPS(b,:)')(1:n) .* end_window * sgn;
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|