[PD] block~: overlap not a power of 2

IOhannes m zmoelnig zmoelnig at iem.at
Fri Sep 2 23:17:09 CEST 2005


Matthias Blau wrote:
> Hi list,
> 
> I am getting error messages saying "block~: overlap not a power of 2".
> Perhaps someone could explain why
> 1.) overlap should be a power of 2

pd processes signals not on a sample-per-sample basis but rather in blocks.
these blocks have a default length of 64.
the length of the blocks can be changed (as you well know), but only to
other 2^n-values. why ? i think because it is easier to do (faster to
code, simpler to optimize,...).
an important factor for using only integer multiples of 64 for
block-length is (imho) that the dsp-tick (once every 64 frames) can be
used for all signal-blocks. (it gets a bit more complicated when you
have blocks <64, but that is a different story)

now what has this to do with the overlap factor ?
well, the overlapping blocks need a) also fit into the dsp-tick-scheme
and b) overlapping should be done reasonably fast.
no with block-sizes being 2^n and overlap-factors being 2^m, the offset
between 2 blocks will always be integer 2^(n-m) [n>m].
if you would want an overlap-factor of 3, the offset between to blocks
would be 64/3 which would involve some interpolation in order to get the
samples "in-between".


> 2.) at the same time, setting overlap to 1.5 (which, after all, is not a
> power of 2) seems to be ok

it is not ok!

one might only think it is, because pd doesn't complain, but you should
really look at the results.
it's because pd will first cast the input to an integer (1.5 will become
1) and afterwards it will check whether the value is 2^n. and 1=2^0

i agree that it should also bail out when getting non-integer values, in
order to not confuse people too much.

mfg.asd.r
IOhannes




More information about the Pd-list mailing list