does the program loop the perform function over and over again, or
just the while(n--) loop? from what i understand the n-- gets a new block of samples right? does that mean that within my while loop i can have more of n-- and get a new block? thanks,
PD _calls_ the perform function repeatedly, and the data in the input arrays reflects the stream of sample values coming in.
The function gets called, you do your calculation with the data, write the result to the output buffers and _exit_ the perform function. It then gets called again with the next samples of the signal stream.... etc.etc.
Neither does PD interrupt the perform function, nor do several tasks run concurrently.
all the best, Thomas
scott
On Thu, 22 Aug 2002, Thomas Grill wrote:
Hi Scott, i'm not quite sure what the problem is, but a few remarks on these
things:
- the block size (= the length of the inupt and output vectors) can be
different from 64...according to the setting of a block~ object in the patcher 2) the input and output arrays can point to the same locations.. that
means
that once you have filled the output array, the input data is lost. I
think,
there is a switch to have separate arrays, though... must be somewhere
with
class setup. 3) if you want to grab a fixed amount of 256 samples for some fft stuff
you
will have to reserve some extra space for fft input and transformed
data.
You start with empty fft in and transformed data. In every dsp perform function you copy the signal input to the fft in buffer. The transformed data is still zero, hence the signal output will be zero. At some time the fft in buffer is filled. You can then do the
transformation
and start copying this output data into the signal output. Your fft
input is
again empty, so you start filling it again.... Once understood, it isn't difficult.
hope that helps, greetings, Thomas
----- Original Message ----- From: "J. Scott Hildebrand" jshildebrand@ucdavis.edu To: "Frank Barknecht" barknech@ph-cip.uni-koeln.de Cc: pd-list@iem.kug.ac.at Sent: Wednesday, August 21, 2002 11:52 PM Subject: Re: [PD] convolution code error
here's a pd concept i do no understand: first take a look at
this
code >>>
t_float lsum = 0.0; t_float rsum = 0.0;
lsum = *in1++; rsum = *in2++; *out1++ = lsum; *out2++ = rsum;
if i have this in my while(n--) loop inside the perform function,
then
it takes input audio and just sends it back out. it works. i don't understand how the input and output arrays work though. i thought that
in
and out were actually arrays with 64 samples in each. right here what
i'm
doing is taking one sample with lsum and rsum, and then i'm spitting
the
output out, and then doing the while loop again. right? what exactly
is
happening? and then what do i need to do to collect 256 samples into
an
array and then use that in my convolution scheme? thanks!
scott
"640K ought to be enough for anybody." -- Bill Gates, 1981
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
"640K ought to be enough for anybody." -- Bill Gates, 1981