Segmentation of audio signal.

45 views (last 30 days)
Djordje Damnjanovic
Djordje Damnjanovic on 13 Jun 2019
Commented: Alsha Babu on 27 Feb 2020
Hello everybody!
I have this issue about segmentation of audio signal. I want to do segmentation of audio signal but with overlap of each segment of 25%. For example, first segment of signal will start from 0 sec to 1 sec, next segment will start from 0.75 sec to 1.75 sec, third segment will start from 1.5 sec to 2.5 sec. etc. Later I need to use each segment seperatly for futher analysis so it is good to put every segment in some vector or again save as audio signal... I create picture where I paint segments in signal.
Thanks in front!

Answers (2)

Star Strider
Star Strider on 13 Jun 2019
Try this:
s = 0.1*randn(1E+4,1)+sin(0.02*pi*(1:1E+4)'-1); % Signal (Column Vector)
L = numel(s); % Vector Length
Fs = 1000; % Sampling Frequency
Ts = 1/Fs; % Sampling Interval
sec1 = 1:Fs; % One-Second Segment Length
secq = fix(3*Fs/4); % 750ms Segment Length
seg = zeros(Fs,fix(L/Fs)); % Preallocate
for k = 1:fix(L/Fs)
seg(:,k) = s(sec1+secq*(k-1)); % Signal Segments
If you only wanted the segments without the offset, the reshape function would have been best.
Alsha Babu
Alsha Babu on 27 Feb 2020
@Star Strider
Could you please tell me how the reshape function can be used to remove the offset?

Sign in to comment.

Greg Dionne
Greg Dionne on 13 Jun 2019
If you have the Signal Processing Toolbox, buffer may be what you're after.
Hope this helps!
  1 Comment
Djordje Damnjanovic
Djordje Damnjanovic on 25 Jun 2019
I will also try with buffer! Thanks!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!