필터 지우기
필터 지우기

Need Help in importing Audio files

조회 수: 2 (최근 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 CenterFile Exchange에서 Speech Recognition에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by