How to process and rewrite multiple wav file into different folder?

조회 수: 3 (최근 30일)
I have a folder with multiple song. After I processed these .wav, I also want to rewrite and put it into different folder. How to do this?
However, this .wav has been already processed from multiple function (wavToPreprocWav.m, wavToElectrode, and electrodeToWav)
Thanks
[y, fs] = audioReadNCU();
[y, fs] = wavToPreprocWav(y, fs);
band = wavToElectrode(y, fs);
y = electrodeToWav(band, fs);
sound(y,fs);
audiowrite('/Users/epriwahyupratiwi/Downloads/GUI/tut1/song test/new.wav',y,fs);
  댓글 수: 2
Antonio Aguirre
Antonio Aguirre 2020년 8월 13일
What is wrong with your approach already, are you getting any errors? You are using audiowrite with the minimum set of required inputs.
Epri Pratiwi
Epri Pratiwi 2020년 8월 13일
I don't know how write the code to process all the file in the folder.

댓글을 달려면 로그인하십시오.

채택된 답변

Kiran Felix Robert
Kiran Felix Robert 2020년 8월 14일
Hi Epri,
It is my understanding that you are trying to read multiple files one by one,process it and save the processed file to a different location. This can be done as shown in the following example (assuming all the files in the read folder are audio files). Refer to the dir documentation for more details.
FileList = dir('*.*');
for i = 1:length(FileList)
file = FileList(i).name;
% perform all necesary functions
% [y,fs] = audioread(file);
% [y, fs] = wavToPreprocWav(y, fs);
%band = wavToElectrode(y, fs);
%y = electrodeToWav(band, fs);
%sound(y,fs);
write_filename = "new_" +num2str(i)+".wav";
%write_directory is the path to the directoy where
%the processed file needs to be saved
audiowrite(write_directory+write_filename,y,fs);
end
Hope this Helps.
Kiran Felix Robert
  댓글 수: 2
SUNKARA GRISHMA
SUNKARA GRISHMA 2021년 5월 2일
as the folder contains multiple files what should be given in place of name

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by