dirs = {'trainingdata/','validationdata/'};
datasets = {'01','02','03','04','05'};
disp(['時間がかかりますので少々お待ち下さい．...' ...
    'trainingdata及びvalidationdataでそれぞれ01～05のフォルダがあります'])
for idir=1:length(dirs)
    disp(dirs{idir})
    for set=1:length(datasets)
        disp(datasets{set})
        wavdirname = strcat(dirs{idir},datasets{set},'/wav');
        filelist = dir(strcat(wavdirname,'/*.wav'));
        jpgdirname = strcat(dirs{idir},datasets{set},'');
        A = exist(jpgdirname,'dir');
        if A==0; mkdir(jpgdirname); end
        for index=1:size(filelist,1)
            wavfilename = strcat(wavdirname,'/',filelist(index).name);
            [~,name,~] = fileparts(filelist(index).name);
            jpgfilename = strcat(jpgdirname,'/',name,'.jpg');
            indata = audioread(wavfilename);
            voiceprint(jpgfilename,indata);
        end
    end
end
%% Copyright 2022 Mutsumi Saito