% SUpDEq - Spatial Upsampling by Directional Equalization function cr = supdeq_convFFT(sig,filtr) Function to perform (2-channel) convolution in frequency domain. Output: cr - Convolution result Input: sig - Audio signal to be filtered (single- or double-channel) filtr - Single- or double-channel filter which should be applied to signal s Dependencies: - (C) 2020 by JMA, Johannes M. Arend TH Köln - University of Applied Sciences Institute of Communications Engineering Department of Acoustics and Audio Signal Processing
0001 %% SUpDEq - Spatial Upsampling by Directional Equalization 0002 % 0003 % function cr = supdeq_convFFT(sig,filtr) 0004 % 0005 % Function to perform (2-channel) convolution in frequency domain. 0006 % 0007 % Output: 0008 % cr - Convolution result 0009 % 0010 % Input: 0011 % sig - Audio signal to be filtered (single- or 0012 % double-channel) 0013 % filtr - Single- or double-channel filter which should be 0014 % applied to signal s 0015 % 0016 % Dependencies: - 0017 % 0018 % (C) 2020 by JMA, Johannes M. Arend 0019 % TH Köln - University of Applied Sciences 0020 % Institute of Communications Engineering 0021 % Department of Acoustics and Audio Signal Processing 0022 0023 function cr = supdeq_convFFT(sig,filtr) 0024 0025 if size(sig,2) > size(sig,1) 0026 sig = sig.'; 0027 warning('Flipped dimensions of signal'); 0028 end 0029 0030 if size(filtr,2) > size(filtr,1) 0031 filtr = filtr.'; 0032 warning('Flipped dimensions of filter'); 0033 end 0034 0035 L = length(sig)+length(filtr)-1; 0036 NFFT = 2^nextpow2(L); 0037 0038 %For two-channel filter and one-channel signal 0039 if size(filtr,2) == 2 && size(sig,2) == 1 0040 sig = [sig,sig]; 0041 end 0042 0043 cr = ifft(fft(sig,NFFT) .* fft(filtr,NFFT)); 0044 cr = cr(1:L,:);