[PD] Array indexing for the wind and the birds

Jeff Rose rosejn at gmail.com
Tue Oct 23 14:37:58 CEST 2007


Whoah, great!  Thanks a lot for the tips Frank and Jamie.  footils.org 
looks like a treasure trove of interesting stuff to learn from.  I think 
with this info I can put together the wind and birds patch.

I'd kind of like to dig a little more into the dynamic patch question 
though.  It seems like a pretty fundamental design decision or 
constraint to not handle dynamic creation and deletion of objects within 
the synthesis engine.  Is this just not an easy thing to do in a visual 
programming environment, or are there architectural reasons?  In NetPD, 
which is incredibly fun, there are number of things you can do 
dynamically, like load instruments and effects, generate new rhythm 
sequences etc.  I thought this seemed like a pretty nice way to do 
things, although I haven't looked into it yet to see if it requires some 
special extensions or something.  Anyways, it would be great to hear 
what experienced people have to say about dynamicity in PD.

Vielen Dank für die Hilfe,
Jeff

Frank Barknecht wrote:
> Hallo,
> Jeff Rose hat gesagt: // Jeff Rose wrote:
> 
>> So I was playing with the FFT example that lets you adjust the gain
>> for frequency bands that gets applied to a plain noise signal.  In
>> messing around I found that I could actually make some cool sounds
>> that seemed like rushes of wind and birds and animals chirping.  So,
>> that's the goal.  I want to make a birds and wind patch based on the
>> resynthesis.pd audio example.  I thought for starters I would use some
>> [metro]s connected to [random]s that would send numbers down to [line]
>> objects, which would generate lines to write into my gain array.  Does
>> this sound like a reasonable strategy?
> 
> Generally a lot of things are resonable strategies. ;) I'm not sure
> that I've understood what you want to do, though. 
> At http://footils.org/cms/show/60 there is a spectral delay patch,
> that maybe can be useful to look at, as it also uses a
> changing array to control gain (and feedback and delay) of FFTs. It
> also includes a way to control the array(s) algorithmically.
> 
>> My real question is how to work with arrays in this manner.  I'd like
>> to use [line] objects to generate small sequences that I write into
>> short segments of an array.  With a for loop this would be straight
>> forward, but I don't know how to iterate through an array, or how to
>> generate the line instantaneously rather than having it take some
>> amount of time like you normally would use line for an envelope or
>> something.
> 
> First you start with a counter [f ]x[+ 1] that you reset to 0 on every
> go and then bang from an [until], which gets started by a number
> instead of a bang. [until] then will bang that many times and thus
> make the counter count from 0 to arraysize.
> 
> With that counter you drive two things: a) an expr-object which holds
> the function that you want to write to the array, like [expr 0.5
> * $f1 - 0.2] or so. Normalize the counter as needed and change
> parameters of expr as well. Then b) you use the counter value as index
> into the array (second inlet of [tabwrite]). Use proper triggering
> with [t a a] to first set the index, then calculate the expr.
> 
> This general technique can be varied with random objects and what not.
> Maybe writing noise with random is a good way to get familiar with it.
> It also is used in the examples a lot, e.g. to write hann-curves or
> bell-curves in the paf examples (F12, F13).
> 
>> In the long run I'll need to remember the start index and length of
>> each "chirp" so that after a short delay I can turn the gain back down
>> at that location.  Anything like a priority queue in PD, so I can just
>> have my delay's pop off the queue?  
> 
> Take a look at qlist, textfile, pipe or list-fifo, list-lifo from the
> [list]-abs abstractions collection. 
> 
>> Also, how tough is it to dynamically create objects from within
>> patches?  Say, if I make a self contained chirp patch that deals
>> with it's own cleanup, can I sort of instantiate it with some
>> parameters and then send it off to do it's thing and die when it's
>> done?  (Was just reading the papers on Chuck, so maybe my mind is
>> thinking in the wrong way for PD...)
> 
> This is not the ideal way of thinking in Pd/Max. For polyphony in Pd
> instead you should create all needed objects in advance and possibly
> switch~ them off when they are not needed to save CPU. Dynamically
> creating objects should only be done on startup of a patch, not while
> it's running.
> 
> Ciao





More information about the Pd-list mailing list