Hallo, derek holzer hat gesagt: // derek holzer wrote: > I still can't understand how to create abstractions for nqpoly and get > it to call them, but at least your version looks a bit cleaner ;-) > > Can you explain in simple steps how to use this patch?
Did you check out the old documentation from the CVS in abstractions/nqpoly/nqpoly4 ? There are some simple examples. Basically using nqpoly4 is easy: Only two arguments are required: The number of instances to create of an abstraction and the name of that abstraction. Additonally four more arguments may be passed, which will be creation arguments of your abstraction. The abstraction you use must have two inlets and one outlet. The right inlet is used as a [loadbang] replacement: It will receive a bang after creation of the instance. You can ignore it if you want. You can ignore the left inlet as well: It will receive messages you send to the first inlet of nqpoly4, but it is "voice managed". That is an incoming message will only be used by one instance, which will then eat this message and not send it along to other instances. Receiving anyhting in inlet0 will also close that instance's inlet, so no further messages are accepted until you send a bang through the outlet, which will open the inlet again. So assuming we have an abstraction delay1000.pd: [inlet] [inlet] | [del 1000] | \ | [print $0-BANG] | [outlet] Then you create [nqpoly4 10 del1000]. This will create 10 instances of [delay1000]. If you send a bang into this [nqpoly4 10 del1000], you will get one message printed like: "1002-BANG: bang". If you sent another one earlier than one second you will get a different message, e.g.: "1003-BANG: bang", because the 1002-instance still is closed and another instance will respond. As the delay will send a bang to the outlet after 1 second, all instances will open itself at some point. Then you will get e.g. the first "1002-BANG: bang" again. The abstractions also will be called with arguments: First arg is the instance index number, second is the total number of instances (10 in the example) and then come the additional up to four arguments, that were passed to nqpoly4. (Additional args are useful for audio objects: just pass $0 as first arg, then put a [throw~ $3-dsp] into your abstraction and use a [catch~ $0-dsp] in the parent.) See attached example for arguments in use. So using [print $1-BANG] instead of [print $0-BANG] will make delay1000 print: 0-BANG: bang 1-BANG: bang 2-BANG: bang ... > Also, if I wanted dynamic voice handling (i.e. voices shut off when not > in use to save CPU), does nqpoly handle this by itself or would I need > to build a [switch~] into the abstraction? nqpoly4 doesn't do anything specific to audio, so you would need to put a switch into your abstraction yourself. But you could use the voice allocation algorithm implemented to switch the switch. Ciao -- Frank Barknecht _ ______footils.org_ __goto10.org__
#N canvas 0 0 596 406 10; #X obj 137 239 catch~ \$0-dsp; #X obj 191 87 s \$0-freq; #X msg 220 119 3; #X msg 258 120 10; #X obj 191 60 mtof; #X obj 138 308 *~ 0; #X obj 161 285 dbtorms; #X obj 164 265 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 8900 1; #X obj 129 337 dac~; #X obj 114 167 nqpoly4 10 partial \$0; #X msg 185 120 2; #X msg 291 119 20; #X floatatom 191 37 5 0 0 0 - - -; #X msg 140 118 1; #X text 336 118 restart audio afterwards!; #X connect 0 0 5 0; #X connect 2 0 9 1; #X connect 3 0 9 1; #X connect 4 0 1 0; #X connect 5 0 8 0; #X connect 5 0 8 1; #X connect 6 0 5 1; #X connect 7 0 6 0; #X connect 10 0 9 1; #X connect 11 0 9 1; #X connect 12 0 4 0; #X connect 13 0 9 1;
#N canvas 0 0 661 395 10; #X obj 66 58 inlet; #X obj 211 35 inlet; #X obj 66 230 outlet; #X obj 66 162 b; #X obj 135 156 osc~; #X obj 211 105 f \$1; #X obj 211 133 + 1; #X obj 211 68 b; #X obj 136 197 /~ 1; #X obj 136 260 throw~ \$3-dsp; #X obj 135 47 r \$3-freq; #X obj 135 131 *; #X obj 135 229 /~ \$2; #X text 251 106 use instance index as harmony selector and amplitude scaler; #X text 194 231 scale total amplitude by total number of instances ; #X text 250 264 throw to outside dsp.; #X msg 174 104 0; #X connect 0 0 3 0; #X connect 1 0 7 0; #X connect 3 0 2 0; #X connect 4 0 8 0; #X connect 5 0 6 0; #X connect 6 0 8 1; #X connect 6 0 11 1; #X connect 7 0 5 0; #X connect 7 0 16 0; #X connect 8 0 12 0; #X connect 10 0 11 0; #X connect 11 0 4 0; #X connect 12 0 9 0; #X connect 16 0 4 1;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
