[PD-dev] scheduling: clocks & audio

Brian Sheehan rbsheehan at yahoo.com
Thu Aug 21 12:47:31 CEST 2003


Hi guenter, thanks for your reply.

Ok, that's what I had figured from the documentation.

Which is why I'm confused - I have a function that is
called by a clock every 20ms, and it takes 8-9 ms to
execute. Audio seems to be produced fine,  and the
function seems to do its job. I only get problems if I
try to decrease the interval between calls to the
function to less than the execution time of the
function (which makes sense).

This seems inconsistent with my understanding of
scheduling... unless i've made a mistake timing the
function - i've been using gettimeofday() (under Mac
OS X).

thanks again,

Brian
--- guenter geiger <geiger at xdv.org> wrote:
> 
> On Wed, 20 Aug 2003, Brian Sheehan wrote:
> > Hi,
> >
> > I want to ask a general question in relation
> > scheduling in pd. I've tried looking at the docs
> and
> > source code, but I'm still confused.
> >
> > >From the docs, audio is computed every 64
> samples, so
> > with a sample rate of 44100 this means that 64
> samples
> > of output must be computed every 1.45 ms.
> >
> > So my question is, if I have a clock object that
> calls
> > a function say every 20ms, and this function takes
> > 10ms to complete, how is audio interleaved with
> the
> > execution of this function? Another way of
> phrasing
> > this would be: are functions that are called by
> clocks
> > executed atomically? Doesn't seem that they can
> be,
> > unless they execute in less than 1.45 ms.
> >
> > any thoughts/explanations are appreciated (i've a
> > feeling they might radically change my
> understanding
> > of how pd works!!)
> 
> Well, yes. you better write functions that take less
> that
> 1.45 ms to finish, .. .much less. PD is not
> multithreaded or
> asynchron, thats what makes messages deterministic
> wrt to the
> audio processing.
> 
> Guenter
> 
> >
> > Brian
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> > _______________________________________________
> > PD-dev mailing list
> > PD-dev at iem.at
> > http://iem.at/cgi-bin/mailman/listinfo/pd-dev
> >
> 
> 
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://iem.at/cgi-bin/mailman/listinfo/pd-dev

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the Pd-dev mailing list