How to read multiple wav files using matlab

Hi, I have a problem in matlab .how to read matrix of wav files (element by element)by using wavread(); . I tried it but it not acceptable . I write this but i have an error. I want to read folder dynamic not static .
[filename, pathname, filterindex] = uigetfile( ...
'*.wav','WAV-files (*.wav)', ...
'Pick a file', ...
'MultiSelect', 'on');
for o = 1:20 % num of fields
[speechIn6,FS6]=wavread(filename(1,o));
speechIn6 = myVAD(speechIn6);
fMatrix6(1,o) = {mfccf(ncoeff,speechIn6,FS6)};
end
Error
??? Error using ==> fileparts at 17
Input must be a row vector of characters.
Error in ==> wavread>open_wav at 193
[pat,nam,ext] = fileparts(file);
Error in ==> wavread at 65
[fid,msg] = open_wav(file);
Error in ==> setTemplates at 74
[speechIn6,FS6]=wavread(filename(1,o));
Thanks a lot :) Best Regards, Nada Gamal

1 件のコメント

Nada Gamal
Nada Gamal 2011 年 4 月 9 日
Answer:
To open Folder and dynmically read files
path='C:\SpeechData\Nada1';
folder = path;
dirListing = dir(folder);
for o = 1:20 % num of fields
for d = 3:length(dirListing)
% loop through the files and open. Note that dir also lists the directories, so you have to check for them.
fileName = fullfile(folder,dirListing(d).name); % use full path because the folder may not be the active path
[speechIn6,FS6]=wavread(fileName);
speechIn6 = myVAD(speechIn6);
fMatrix6(1,o) = {mfccf(ncoeff,speechIn6,FS6)};
Nada Gamal

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2011 年 4 月 9 日
編集済み: Walter Roberson 2017 年 2 月 14 日

1 投票

[filenames, pathname, filterindex] = uigetfile( '*.wav', 'WAV-files (*.wav)', 'Pick a file', 'MultiSelect', 'on');
filenames = cellstr(filename); %in case only one selected
for K = 1 : length(filename)
thisfullname = fullfile(pathname, filenames{K});
[speechIn6,FS6]=wavread(thisfullname);
speechIn6 = myVAD(speechIn6);
fMatrix6(1,o) = {mfccf(ncoeff,speechIn6,FS6)};
end

7 件のコメント

Nada Gamal
Nada Gamal 2011 年 4 月 9 日
Thanks Walter for your reply . And I want to ask another question can i pass path of folder only and then the folder opened and take its files and make all operations to all files dynamic not static .
Thanks alot :)
Nada Gamal
Nada Gamal
Nada Gamal 2011 年 4 月 9 日
Thanks a lot i have solved the problem . Really Thanks Walter :):)
Pooja Patel
Pooja Patel 2017 年 2 月 14 日
i ma getting "The expression to the left of the equals sign is not a valid target for an assignment." this error in second line. please help me to solve this
Walter Roberson
Walter Roberson 2017 年 2 月 14 日
The ... continuations would have confused it.
Aamir Ashraf
Aamir Ashraf 2018 年 11 月 23 日
I'm new to matlab so bare with me.
What is "[speechIn6,FS6]=wavread(thisfullname);"
Matlab doesn't have a command "waveread" and i'm sure what "[speedIn6,FS6]" is
Tiffani Febiola
Tiffani Febiola 2021 年 10 月 31 日
I try the codes from mr. Walter Roberson but its said:
Unrecognized function or variable 'filename'.
Error in Untitled (line 2)
filenames = cellstr(filename); %in case only one selected
Walter Roberson
Walter Roberson 2021 年 10 月 31 日
[filenames, pathname, filterindex] = uigetfile( '*.wav', 'WAV-files (*.wav)', 'Pick a file', 'MultiSelect', 'on');
filenames = cellstr(filenames); %in case only one selected
for K = 1 : length(filenames)
thisfullname = fullfile(pathname, filenames{K});
[speechIn6, FS6] = audioread(thisfullname);
speechIn6 = myVAD(speechIn6);
fMatrix6{1,K} = mfccf(ncoeff, speechIn6, FS6);
end

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by