[PD] Simultaneous Computation

2009-03-09 Thread Hannes Gräuler
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?

Thanks for reading,

Hannes


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Simultaneous Computation

2009-03-09 Thread IOhannes m zmoelnig

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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Simultaneous Computation

2009-03-09 Thread Martin Peach

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



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list