필터 지우기
필터 지우기

splitting an audio file into 1s, for max, audio files

조회 수: 5 (최근 30일)
fatima alansari
fatima alansari 2019년 4월 12일
댓글: Walter Roberson 2021년 11월 20일
Hello,
I searched for splitting an audio file into smaller audio files in MATLAB, but I couldn't find a clear way to do so.
Is there any way I can follow in MATLAB to split my audio file into smaller audio files where each file does not exceed 1s???
Regards

채택된 답변

Geoff Hayes
Geoff Hayes 2019년 4월 12일
fatima - you could use audioread to read the data and then split into smaller ~1 second blocks of data. For example,
[y,Fs] = audioread(filename);
n = length(y);
for k = 1:Fs:n
audioBlock = y(k:min(k + Fs - 1, n), :);
% do something with this block
end
Note how we use the sampling frequency Fs (number of samples per second) to make sure that each audio block is of one second duration. We use
min(k + Fs - 1, n)
to handle the last audio block where we might not have Fs samples.
You could then use audiowrite to write the block to file. But do you really want to split the potentially large file into so many smaller ones?
  댓글 수: 3
Syed Islam
Syed Islam 2021년 11월 20일
Hi i am new to matlab and i have a problem in which i have two audio signal "x" and "y". y is a snippet of x(full audio signal). Now i have to find where exactly y(snippet) is in x(full audio signal).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation and Deployment에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by