Merging two itaAudio objects with different length
When merging two itaAudio objects with different length e.g. longrand = randn(1000,1); shortrand = randn(200,1); fs = 48000;
The behaviour depends on the signalType (energy or power).
%% merging power signals a = itaAudio(longrand,fs,'time'); b = itaAudio(shortrand,fs,'time'); ita_merge(a,b) % merge@itaAudio: signal length does not match, extracting samples. Some samples will be lost!
-> Here the longer signal is truncated and information is lost
% merging energy signals a = itaAudio(longrand,fs,'time'); a.signalType = 'energy'; b = itaAudio(shortrand,fs,'time'); b.signalType = 'energy'; ita_merge(a,b) % merge@itaAudio: signal length does not match, interpolation in frequency domain
-> Here the shorter signal is interpolated in the frequency domain by spline interpolation. Comment in code says "%Interpolation in frequency domain is safer, though not perfect"
Would it not make more sense to simply zero pad the shorter signal in both cases? Zeropadding leads to better resolution in frequency domain, when consequently increasing the fftSize, and thus and implicit "interpolation". If I am not mistaken, in the currently implemented way of interpolation will introduce some error into the signal, e.g. when going forth and back. Happy to discuss this here =)