hello
am not an expert in matlab and using this code to load multiple wav sound in matlab now how I can process data so I can run the extract features like find peaks,...… and other feature ( I got the feature codes but I to process these first ).
numfiles = 2;
mydata = cell(1, numfiles);
for k = 1:numfiles
myfilenames = sprintf('a%d.wav', k);
mydata{k} = importdata(myfilenames);
end

댓글 수: 1

sam aldoss
sam aldoss 2018년 10월 14일
my question was how to process the wav files after loading in matlab

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 10월 14일

0 개 추천

for k = 1 : numfiles
thisdata = mydata{k};
[peaks{k}, peaklocs{k}] = findpeaks(thisdata);
end

댓글 수: 6

sam aldoss
sam aldoss 2018년 10월 14일
this was wrong I have try this one but it says Expected Y to be one of these types:
double, single
Walter Roberson
Walter Roberson 2018년 10월 14일
편집: Walter Roberson 2018년 10월 14일
numfiles = 2;
mydata = cell(1, numfiles);
for k = 1:numfiles
myfilenames = sprintf('a%d.wav', k);
[mydata{k}, myfs{k}] = audioreader(myfilenames);
end
for k = 1 : numfiles
thisdata = mydata{k};
thisfs = myfs{k};
thistime = (1:size(thisdata,1)) ./ thisfs;
for chan = 1 : size(thisdata, 2)
[peaks{k, chan}, peaklocs{k, chan}] = findpeaks(thistime, thisdata(:,chan));
end
This would need a slight adjustment if you want the first sample to be considered to be at time 0 instead of time 1/fs.
The code isolates peaks independently for any channels. If there is a mix of number of channels in the files, then some of the peaks{k,channel} and corresponding peaklocs{K,channel} entries might be []
sam aldoss
sam aldoss 2018년 10월 14일
Undefined function or variable 'audioreader'.
sam aldoss
sam aldoss 2018년 10월 14일
my question was how to process the wav files after loading in matlab
Walter Roberson
Walter Roberson 2018년 10월 14일
audioread() instead of audioreader()
“Alice: Would you tell me, please, which way I ought to go from here?
The Cheshire Cat: That depends a good deal on where you want to get to.
Alice: I don't much care where.
The Cheshire Cat: Then it doesn't much matter which way you go.
Alice: ...So long as I get somewhere.
The Cheshire Cat: Oh, you're sure to do that, if only you walk long enough.”
sam aldoss
sam aldoss 2018년 10월 15일
thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Standard File Formats에 대해 자세히 알아보기

질문:

2018년 10월 14일

댓글:

2018년 10월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by