Matlab批量处理指定文件夹下的所有音频文件

filedir='E:/source/Wavfile/*.wav'; % 设置路径
outfiledir='E:/output/Wavfile/';
infiledir='E:/source/Wavfile/';
files = dir(filedir);

for i = 1 : length(files)
infile = [infiledir,files(i).name];
[x,fs] = audioread(infile);
x_L = x(:,1);
x_R = x(:,2);
y = x_L + x_R;
outfile_L = [outfiledir,files(i).name(1:end-4),'_L.wav'];
outfile_R = [outfiledir,files(i).name(1:end-4),'_R.wav'];
outfile_Y = [outfiledir,files(i).name(1:end-4),'_Y.wav'];
audiowrite(outfile_L, x_L , fs);
audiowrite(outfile_R, x_R , fs);
audiowrite(outfile_Y, y , fs);
end

上一篇:[WPF]如何调试Data Binding


下一篇:WorldWind源码剖析系列:四叉树瓦片集合类QuadTileSet