I am trying to use the following crossfading code in MATLAB. I use
audioread() to open the audio signals and I convert both of them to mono. When I use .wav files, it works perfectly fine. But when I use .aif files, I get the following warning message for the last line:
"Subscript indices must either be real positive integers or logicals."
Is there any way I can fix it without having to convert my audio signals?
n = 200; W = linspace(1,0,n)'; S1(end-n+1:end) = S1(end-n+1:end).*W; S2(1:n) = S2(1:n).*(1-W); S12 = zeros(size(S1,1) + size(S2,1) - n, 1); S12(1:size(S1,1)) = S1; S12(end-size(S2,1)+1:end) = S12(end-size(S2,1)+1:end) + S2; %this is where I get the warning