[PD] Simultaneous Computation

IOhannes m zmoelnig zmoelnig at iem.at
Mon Mar 9 15:45:19 CET 2009


Hannes Gräuler wrote:
> Hi all,
> 
> I'm new to Pd and I'm looking for some hints on implementing a DSP external.
> I want to implement an external which is capable of simultaneous calculation
> of 2 or more coupled instances of it.
> 
> On the signal level, this is not possible, because the construction of the DSP
> tree forbids feedback loops.
> 
> Another way to achieve simultaneous computation of coupled objects is the
> following: The coupled objects exchange their adresses via pointer messages.
> Now, when the signal of the first of the coupled objects is about to be
> computed it should also calculate all coupled objects and store each result
> in a buffer. When the DSP-perform on of the remaining objects is called,
> it simply copies the buffer its outlet.

hmm, but you know that you might not have the input signals available at 
your "other" objects yet.

so the best you could come up with that way can be simulated by a simple 
  singleton oscillator which you distribute via [send~].

i guess this is not what you want.


> 1. While the above proposal feels like a hack to me, I'd like to ask if there
>     is any other (smarter) way to enable simultaneous computations?

i don't fully understand why you actually need simultaneous computations.

the trivial answer is of course to do the simultaneous computation in a 
single object... and handle "simultaneousity" on the patch-level rather 
than the object-level.

> 
> 2. Given my proposal is worth to be tried, how would I get to know the "first
>     of the coupled objects"? Is there a way to get the timestamp of the current
>     DSP iteration, so that I can determine when to calculate all buffers?

there's a non-public, non-exported function "ugen_getsortno()" which is 
used for this very purpose in d_delay.c
depending on your linker, you might be able to use it anyhow (note that 
it must be called in the _dsp() callback)

fgamdr
IOhannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090309/2a01234a/attachment.bin>


More information about the Pd-list mailing list