[PD] Simultaneous Computation

Martin Peach martin.peach at sympatico.ca
Mon Mar 9 15:57:58 CET 2009


Hannes Gräulerwrote:

>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.
>
>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?
>
>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?
>

Maybe if you have two inlets and two outlets on each object and you chain 
the objects like this:

[audio in]
|\______
|          [*~ 0]
|          |
[parallel~]
|          |
[parallel~]
|          |
[parallel~]
           |
           [audio out]
The first inlet just passes the audio block through to the first outlet. The 
second inlet receives the buffer block from the previous stage. The object 
does its processing on the raw audio block and modifies the buffer block. 
The entire chain will be executed once per audio block.

Of course if all you are doing is adding to the buffer you can just connect 
all the objects to the same inlet.

Martin






More information about the Pd-list mailing list