pd internals (was Re: [PD] switcher?)
geiger at xdv.org
Fri Jun 6 12:48:51 CEST 2003
On Fri, 6 Jun 2003, Tim Blechmann wrote:
> > Try to solve the problem within pd, there are several ways, and some
> > are even better as matrix~, because you save CPU when generators are
> > switched off.
> > If you do it that way, you will not only have the problem solved, but
> > you will get the understanding of how PD works.
> i understand your approach to minimize the use of externals. but i
> have a few general questions about how pd works:
> - dsp cycles: if i have a complex calculation that requires several pd
> objects, will it take several dsp cycles (one for each object) or is
> it calculated at once. eg, if i have an abstraction that does 100
> calculations (one after another) when i send a bang, would it take
> 100 dsp cycles?
No, message (control) objects are calculated when they get triggered
(this is different from ~ objects).
Normally, if you have a complicated calculation this will not cost
too much CPU, because its a one time event.
These kinds of calculations get critical though, if you trigger them
really frequently, use loops, etc, etc.
> - how can you switch of the calculation of some generators /
> subpatches / patches? (i would really need this in my patches)
yes, in subpatches you can use the [switch~] object, which will
turn on and off audio calculations.
> - abstractions vs externals: i suppose externals would be faster (if
> you want you could even write your external in the assembler
> language of your machine), but require more ram (more code, maybe
> larger classes)... is this correct?
> thanks a lot...
Well, the drawback of externals is that they require more time to write,
are inherently inflexible, harder to port, harder to debug, maintain,
read, dangerous (can crash pd) , ....
Reasons to write and use externals are:
- can't built the same functionality with abstraction
- if I built the same as an abstraction its
* too slow
* not easily possible
- I need some dynamic behaviour that is not easily possible in pd
Finally, I think it pays off to read through the documentation of pd
and try to understand it.
> Tim mailto:TimBlechmann at gmx.net
> ICQ: 96771783
> The only people for me are the mad ones, the ones who are mad to live,
> mad to talk, mad to be saved, desirous of everything at the same time,
> the ones who never yawn or say a commonplace thing, but burn, burn,
> burn, like fabulous yellow roman candles exploding like spiders across
> the stars and in the middle you see the blue centerlight pop and
> everybody goes "Awww!"
> Jack Kerouac
More information about the Pd-list