how to sample an audio file ?

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 5 月 4 日

0 投票

[data, fs] = audioread('name_of_file_goes_here.wav');
num_seconds = 1; %does not need to be integer
sample_length = floor(fs * num_seconds);
sample_start = randi([1, size(data,1)-sample_length+1]);
sample = data(sample_start:sample_start+sample_length-1, :);

質問済み:

2021 年 5 月 4 日

回答済み:

2021 年 5 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by