[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer (signal)?
From: |
Sciss |
Subject: |
Re: buffer (signal)? |
Date: |
Thu, 10 Apr 2008 22:36:07 +0200 |
the description is here:
http://www.mathworks.com/access/helpdesk/help/toolbox/signal/buffer.html
meanwhile i started to write something based on that doc. beware as
i'm absolutely bad with matlab/octave syntax and i stopped to
implement it when it did it's job (see below) ;-)
%%% begin buffer.m
function [y, z, opt] = buffer( x, n, p, opt )
disp( "WARNING: buffer is a quick hack, don't use for continuous
buffering" );
if nargin < 3, p = 0; end;
L = length(x);
if p <= 0
if nargin < 4, skip = 0; else skip = opt; end;
pre = [];
m = floor((L-skip)/(n-p)) + (rem((L-skip),(n-p)) >= n);
z = zeros( (L-skip) - m*(n-p) );
else
if nargin < 4, pre = zeros( p, 1 ); else pre = opt; end;
skip = 0;
if strcmp( pre, 'nodelay' )
pre = 0;
m = floor((L-n)/(n-p))+1;
z = zeros( L - ((m-1)*(n-p)+n) );
else
m = floor(L/(n-p));
z = zeros( L - m*(n-p) );
end;
end;
y = zeros( n, m );
q = n * m;
y(1:length(pre))=pre;
i = length(pre);
j = skip;
while (i < q && j < L)
nn = min( min( n, q - i ), L - j );
y((i+1):(i+nn))=x((j+1):(j+nn));
i = i + n;
j = j + n - p;
endwhile
%%% end buffer.m
i used this with a very interesting tool from
http://cosmal.ucsd.edu/cal/projects/CATbox/catbox.htm
--> the ConstQ spectrum analysis tool. all i had to change is to
comment out the line
progressbar(i/N);
in cqgram.m since it produces some errors with gnuplot. i get
impressive results, like:
x = auload( '/Users/rutz/Desktop/SineSweep.wav' );
cqgram( x, 16384, 16384-256, 32, 22050, 24, 44100 );
ciao, -sciss-
Am 10.04.2008 um 22:25 schrieb Ben Abbott:
On Thursday, April 10, 2008, at 12:59PM, "Sciss" <address@hidden>
wrote:
hi,
i am trying to run a function that was written for matlab. it breaks
because the function 'buffer' is missing, something that creates an
overlapped-chunk version of a vector. on octave-forge's documentation
site, it is stated:
"buffer [signal] -- not implemented"
... so i assume this function is missing? i installed the signal
package but no luck. any clues how i can get a 'buffer' function for
octave?
thanks a lot! cheers, -sciss-
From the most recent Matlab (7.6)
which buffer
'buffer' not found.
Apparently "buffer" is not a core Matlab function.
By chance is the function you're looking for actually a class? ...
for example,
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?
objectId=14087
If not, can you tell us what "buffer" is supposed to do?
Ben