in Matlab I am able to clip/trim pairs of audio signals (same frequency) using finddelay as follows, so that they are aligned and have the same length:
d12 = finddelay(s1,s2);
if(d12 < 1)
start1 = -d12+1;
start2 = 1;
end1 = length(s1);
end2 = min(length(s1(-d12+1:end)), length(s2));
else
start1 = 1;
start2 = d12+1;
end1 = min(length(s2(d12+1:end)), length(s1));
end2 = length(s2);
end
clipped_s1 = s1(start1:end1);
clipped_s2 = s2(start2:end2);
I would like to do the same with 3 signals or more, so far I was trying to take start/end bounds for pairs of signals, i.e. d12, d23, d31, and then taking the max for the start index and the min for the end index of the corresponding indices. However, it does not give me equal bounds for s1, s2, s3, I am fundamentally misunderstanding something. Anyone has any advice?