Need Help in importing Audio files

1 回表示 (過去 30 日間)
Satyam Gaba
Satyam Gaba 2018 年 4 月 3 日
回答済み: Dinesh Iyer 2018 年 4 月 27 日
Hi, I want to import 50 audio files with name as "s1,s2,...s50" and train them for speaker recognition purpose.
if true
[training_data1,fs_training1]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S1.wav');
[training_data2,fs_training2]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S2.wav');
[training_data3,fs_training3]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S3.wav');
[training_data4,fs_training4]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S4.wav');
[training_data5,fs_training5]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S5.wav');
[training_data6,fs_training6]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S6.wav');
[training_data7,fs_training7]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S7.wav');
[training_data8,fs_training8]=audioread('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\S8.wav');
end
something like this.
how can I use loop, "like for or while" in this process? TIA

回答 (1 件)

Dinesh Iyer
Dinesh Iyer 2018 年 4 月 27 日
You can use the FileDataStore object and supply audioread as the custom read function. This will save you the hassle of looping:
fds = fileDatastore('C:\Users\Satyam\Documents\MATLAB\SOP\data\train\','ReadFcn',@audioread, 'FileExtensions', '.wav');
while hasdata(fds)
[y, Fs] = read(fds);
end
See the documentation for this function here: https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.filedatastore.html

カテゴリ

Help Center および File ExchangeSpeech Recognition についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by