[PD] scores with datastructure

Frank Barknecht fbar at footils.org
Mon Mar 27 12:56:47 CEST 2006


Hallo,
patco hat gesagt: // patco wrote:

> --- Frank Barknecht <fbar at footils.org> a écrit :
> 
> > I think it would be interesting to have a more general struct
> > definition for notes instead of one defintion for each possible note
> > type like half, quarter, dotted etc.
> 
> Well, it would be already done if I've found a procedure
> to plot with "y spacing", but that fonction is cruelly missing
> or I haven't found this in the docs,
> or my understanding of arrays is cruelly limited.

As a property of "plot" the function indeed is missing, however a
simple trick to achieve a similar result is possible. Basically you
set the x-spacing in [plot] to 0, so that all array elements have the
same x-position, then you use the y-field of the array-elements to
make them appear at different heights. I attached an example to
illustrate this.

> > Flags would be a candidate for an array, too. Depending on the length
> > of the "flags" array, we would get 1/16, 1/32,... notes.
> 
> Flags also need "y spacing".

A similar trick as above could be used, I believe.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 542 170 615 497 10;
#N canvas 497 295 594 377 hline 0;
#X obj 93 93 drawpolygon 0 1 0 0 l 0;
#X obj 430 205 pointer;
#X msg 430 182 traverse \$1 \, bang;
#X obj 323 281 outlet;
#X obj 94 61 struct hline float y float l;
#X obj 323 254 append hline y l;
#X obj 323 151 unpack 0 0 s;
#X obj 323 131 inlet;
#X connect 1 0 5 2;
#X connect 2 0 1 0;
#X connect 5 0 3 0;
#X connect 6 0 5 0;
#X connect 6 1 5 1;
#X connect 6 2 2 0;
#X connect 7 0 6 0;
#X restore 376 164 pd hline;
#N canvas 0 0 682 485 ladder 0;
#X obj 411 254 pointer;
#X msg 411 231 traverse \$1 \, bang;
#X obj 297 335 outlet;
#X obj 297 308 append ladder x y;
#X obj 70 65 struct ladder float x float y array hlines hline;
#X obj 297 149 inlet;
#X obj 70 104 plot hlines 0 0 0 0 0;
#X obj 297 176 unpack 0 0 s;
#X connect 0 0 3 2;
#X connect 1 0 0 0;
#X connect 3 0 2 0;
#X connect 5 0 7 0;
#X connect 7 0 3 0;
#X connect 7 1 3 1;
#X connect 7 2 1 0;
#X restore 303 164 pd ladder;
#N canvas 75 189 450 300 show 1;
#X restore 379 115 pd show;
#X msg 303 90 clear;
#X obj 303 115 s pd-show;
#X obj 146 196 setsize ladder hlines;
#X obj 161 346 element ladder hlines;
#X floatatom 55 102 5 0 0 0 - - -;
#X obj 75 244 f 0;
#X obj 102 245 + 1;
#X obj 75 157 t f b f;
#X msg 116 221 0;
#X obj 75 220 until;
#X obj 75 273 t a a;
#X obj 75 397 * 10;
#X floatatom 98 376 5 0 0 2 y-spacing - -;
#X msg 31 42 5;
#X obj 31 124 moses 1;
#X obj 31 68 t a b b;
#X text 445 165 structs;
#X text 442 112 drawing subpatch;
#X text 67 42 press me first!;
#X obj 75 451 set hline y l;
#X obj 75 418 pack 0 400;
#X msg 303 138 20 100 pd-show;
#X text 443 138 x y subpatch-revceiver;
#X connect 1 0 5 1;
#X connect 1 0 6 1;
#X connect 3 0 4 0;
#X connect 6 0 22 2;
#X connect 7 0 17 0;
#X connect 8 0 9 0;
#X connect 8 0 13 0;
#X connect 9 0 8 1;
#X connect 10 0 12 0;
#X connect 10 1 11 0;
#X connect 10 2 5 0;
#X connect 11 0 8 1;
#X connect 12 0 8 0;
#X connect 13 0 14 0;
#X connect 13 1 6 0;
#X connect 14 0 23 0;
#X connect 15 0 14 1;
#X connect 16 0 18 0;
#X connect 17 1 10 0;
#X connect 18 0 17 0;
#X connect 18 1 24 0;
#X connect 18 2 3 0;
#X connect 23 0 22 0;
#X connect 24 0 1 0;


More information about the Pd-list mailing list