2

I understand that we can use the buffer function in matlab to split a long signal into overlapping frames. But is there any functions that we can use to put the frames back to reconstruct the signal?

Here's my current code in Matlab

n = 0.1:0.1:100;
y = sin(n*pi*0.5)';
Nw = 100;  % window length
Nh = 25;   % hop size
Y = buffer(y,Nw,Nw-Nh, 'nodelay');  % Y is the matrix containing the overlapping frames

What I want to do next is to use Y to reconstruct the original signal y. Something like this

yNew = unbuffer(Y, Nw, Nw-Nh)

Of course there is no such function as unbuffer, not that I've known of. So my question is, is there any function available to do the job of unbuffer ?

The situation is similar to this question here: https://www.reddit.com/r/matlab/comments/361y9w/reverse_buffer_function/, which was 5 years ago and still received no answers.

Jay
  • 21
  • 2

2 Answers2

1

If you want to do any overlap and arbitrarily large vectors while being fast it is a bit cumbersome.

If you only do 50% overlap, then it is straight forward to write an unbuffer function

Knut Inge
  • 1,829
  • 5
  • 9
0

unbuffer in Python; helpful post. Nice visuals in MATLAB docs (bottom).

OverLordGoldDragon
  • 3,570
  • 2
  • 6
  • 30