Cut an audio file into regularly spaced units

6 ビュー (過去 30 日間)
Butterflyfish
Butterflyfish 2019 年 7 月 20 日
コメント済み: Star Strider 2019 年 7 月 21 日
Hi,
I would like to cut long audio files into regularly spaced units of regular size, and save these units as new audiofiles.
So far I have:
[soundfile, Fs] = audioread('soundfile.wav');
UnitsSamples = 120 * Fs; % the nb of samples to make a unit of 2 minutes
UnitsBreak = 600 * Fs; % the nb of samples to leave out 10 minutes in between units
How do I continue if I would like to save n units of 2 minutes each every 10 minutes for the whole sound file?
Many thanks for any help!

採用された回答

Star Strider
Star Strider 2019 年 7 月 20 日
I would use the Signal Processing Toolbox buffer function to segment your signal.
One possibility:
y = buffer(soundfile(:,1), 120*Fs); % Specify Column (If Stereo Signal)
That will create non-overlapping segments of your file that are each ‘120*Fs’ samples in length, and will zero-pad any columns that are not of the required length.
  3 件のコメント
Butterflyfish
Butterflyfish 2019 年 7 月 21 日
This works perfectly! Many thanks for the swift help!!
Star Strider
Star Strider 2019 年 7 月 21 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by