Parse Error at '['
3 views (last 30 days)
Show older comments
function [fdly,tdly] = audio(sig1,sig2)
i = 1;
j = 1;
fdly = zeros(1,266);
tdly = zeros(1,266);
while (i <= 12768000)
a = sig1(i:48000);
b = sig2(i:48000);
[cor,lag] = xcorr(a,b,'coeff');
[~,Il] = max(abs(cor));
fdly(j) = lag(Il);
tdly(j) = fdly(j)/48000;
i = i+48000;
j = j+1;
end
end
*[* sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
I am getting parse error at the marked bracket, I don't know why!
2 Comments
Guillaume
on 22 May 2018
Please post (or attach as a m file) the exact code you're using. Without any modification. Also post the full text of the error message.
You've given us conflicting versions of your code. With this particular error, the problem is from what comes before the [.
Answers (1)
KSSV
on 22 May 2018
[sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
There should be no stars, in the first place. And this line should be copied above your function audio not, after the function.
3 Comments
KSSV
on 22 May 2018
Save this code first, defualt this will be saved on the name delaycalc. Save this in some folder.
function [fdly,tdly] = delaycalc(sig1,sig2)
i = 1;
j = 1;
fdly = zeros(1,266);
tdly = zeros(1,266);
while (i <= 12768000)
a = sig1(i:48000);
b = sig2(i:48000);
[cor,lag] = xcorr(a,b,'coeff');
[~,Il] = max(abs(cor));
lagdly = lag(Il);
tmdly = lagdly/48000;
i = i+48000;
j = j+1;
display(tmdly)
display(lagdly)
end
And then, change the path, and go to that folder. Now, you can call that function.
[sp1,fs1] = audioread('F:\Moodle\Summer18\sync porject\iitb recordings\01_SPK1_05_06_2017-09.wav');
[fdly,tdly] = delaycalc(sp1,fs1)
See Also
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!