[PD] Vline~ subsample accuracy clarification

Claude Heiland-Allen claudiusmaximus at goto10.org
Mon Oct 11 00:55:55 CEST 2010

On 10/10/10 23:20, Oliver Larkin wrote:
> Hi,
> Can someone explain to me how vline~ can "align the endpoints of the
> envelope, accurate to a fraction of a sample"

You need to know some background about pd's scheduler for the following 
to make sense, here are some reasonable places to start reading:

Re: [PD] accuracy of signal/message-objects
IOhannes m zmoelnig
Tue, 08 May 2007 00:16:54 -0700

Re: [PD] accuracy of signal/message-objects
Frank Barknecht
Wed, 09 May 2007 05:40:28 -0700

Essentially, Pd has a 'logical clock', which means messages have a time 
stamp that clock-aware objects can access.  All the messages that would 
happen in 1 DSP block are executed before that DSP block is computed, 
which means that for example [vline~] can collect all its messages with 
time stamps so it knows exactly when each line segment is due to start.

Then, for each sample in the DSP block, [vline~] checks if the current 
segment is over.  If it isn't over, it outputs the next sample and 
carries on.  If it has ended (most likely in-between the previous sample 
and the current sample), it uses the time stamps to start the next 
segment at exactly the right time, and calculates how far along that 
ramp it will be at the timestamp of the current sample.

Of course the source code is more complicated than that, lots of things 
to consider like multiple line segments in between two samples, constant 
hold at the end of a line segment when no other is scheduled yet, etc. 
The main thing to note is that the time stamps are subsample accurate, 
which means clock-aware objects can be schedule messages with subsample 
accuracy.  Of course, how much sense it is to implement this is a bit 
fuzzy - if you have 10000 line segments in between 2 adjacent sample 
points, you'll miss out on a lot of detail...

> I don't really see how that's possible. my guess is that it's somehow
> similar to the way interpolation is used in fractional delay lines,
> but I can't quite translate that idea to an envelope.
> Thanks
> Oli


More information about the Pd-list mailing list