필터 지우기
필터 지우기

How to replaced extracted audio files running in a for loop?

조회 수: 3 (최근 30일)
whalelady
whalelady 2020년 4월 15일
댓글: Ameer Hamza 2020년 4월 15일
Hello Community,
I am trying to do some features extractions in m4a, trying to extract and replace several audios which are running in a for loop with the initial 'p'.
Audio_files(p).name consist of individual .m4a files running in the for loop with the initial 'p'.
I am running into some problems with my audiowrite line. How should I rewrite the line? What am I missing here? Thank you in advance! :)
[data,samp_rate] = audioread(Audio_files(p).name);
%% equations worked on the audio file and get s, the new starting point of the audio
startSample = s;
endSample = length(data);
extractedData = data(startSample:endSample);
audiowrite(Audio_files(p).name '.m4a', extractedData,fs );

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 15일
편집: Ameer Hamza 2020년 4월 15일
audiowrite cannot save the file in .mat format. Use extension of an audio file. Also use concotenation brackets [ ]
audiowrite([Audio_files(p).name '.wav'], extractedData,fs );
  댓글 수: 4
whalelady
whalelady 2020년 4월 15일
Thank you Hamza!
Ameer Hamza
Ameer Hamza 2020년 4월 15일
I am glad to be of help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by