[PD] polyphonic ? key, keyup setup question

Frank Barknecht fbar at footils.org
Wed Oct 4 21:07:33 CEST 2006


Hallo,
padawan12 hat gesagt: // padawan12 wrote:

> You can try setting your key repeat to the lowest rate possible
> and the longest delay before it starts, on linux/unix
> 
> kbdrate -r 2 -d 1000

Hm, I don't have the kbdrate command on my machine, but alternatively
you may use "xset" to set keyboard specifics. "xset -r" will switch
off autorepeat altogether, "xset r" will switch it back on.

Attached is another way to get at keyboard data in Pd that is suited
to be used to built a midi-keyboard from a standard PC keyboard. It
involves an abstraction "keytrans.pd" which should be used with two
argument as [keytrans <keyname> <midi note>] and will output a list of
"<frequency> <keypress state as 0 or 1>" if the respective key passed
as <keyname> is pressed or released. It's a good example for when
an abstraction can save a lot of typing and connecting work.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 311 204 782 431 10;
#X obj 195 61 keyname;
#X obj 195 187 route \$1;
#X obj 274 267 f \$2;
#X obj 58 357 outlet;
#X text 295 95 swap output of [keyname] to be a list: <keyname> <state>
;
#X obj 195 146 list trim;
#X text 294 145 trim the "list" selector;
#X obj 58 61 inlet;
#X text 28 34 pass-through trick to make connecting easier;
#X obj 274 289 mtof;
#X text 38 386 list <freq> <0|1>;
#X obj 195 95 list prepend;
#X obj 274 247 loadbang;
#X obj 195 312 list prepend;
#X text 316 280 prepend the desired frequency from a midi note passed
as argument 2;
#X text 293 181 wait for the key passed as first argument. Output after
this stage is: 1 (down) or 0 (up) for the selected keyname.;
#X connect 0 0 11 0;
#X connect 0 1 11 1;
#X connect 1 0 13 0;
#X connect 2 0 9 0;
#X connect 5 0 1 0;
#X connect 7 0 3 0;
#X connect 9 0 13 1;
#X connect 11 0 5 0;
#X connect 12 0 2 0;
#X connect 13 0 3 0;
-------------- next part --------------
#N canvas 51 74 338 505 10;
#X obj 38 222 osc~ 440;
#X obj 97 86 poly 3 1;
#X obj 97 119 pack f f f;
#X obj 97 146 route 1 2 3;
#X obj 38 193 unpack f f;
#X obj 38 274 throw~ out;
#X obj 109 319 catch~ out;
#X obj 108 378 dac~;
#X obj 38 247 *~;
#X obj 119 223 osc~ 440;
#X obj 119 194 unpack f f;
#X obj 119 275 throw~ out;
#X obj 119 248 *~;
#X obj 200 223 osc~ 440;
#X obj 200 194 unpack f f;
#X obj 200 275 throw~ out;
#X obj 200 248 *~;
#X obj 109 342 *~ 0.25;
#N canvas 0 0 895 337 keys 1;
#X obj 772 203 outlet;
#X obj 60 178 keytrans a 60;
#X obj 423 152 keytrans t 66;
#X obj 121 150 keytrans w 61;
#X obj 163 178 keytrans s 62;
#X obj 222 151 keytrans e 63;
#X obj 261 178 keytrans d 64;
#X obj 366 177 keytrans f 65;
#X obj 468 177 keytrans g 67;
#X obj 523 151 keytrans z 68;
#X obj 523 131 keytrans y 68;
#X obj 570 176 keytrans h 69;
#X obj 627 153 keytrans u 70;
#X obj 672 176 keytrans j 71;
#X obj 772 176 keytrans k 72;
#X text 521 112 qwertz and qwerty!;
#X text 90 74 keytrans <keyname> <midi note>;
#X connect 1 0 3 0;
#X connect 2 0 8 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 10 0;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X connect 11 0 12 0;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 14 0 0 0;
#X restore 97 55 pd keys;
#X connect 0 0 8 0;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 1 2 2 2;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 1 10 0;
#X connect 3 2 14 0;
#X connect 4 0 0 0;
#X connect 4 1 8 1;
#X connect 6 0 17 0;
#X connect 8 0 5 0;
#X connect 9 0 12 0;
#X connect 10 0 9 0;
#X connect 10 1 12 1;
#X connect 12 0 11 0;
#X connect 13 0 16 0;
#X connect 14 0 13 0;
#X connect 14 1 16 1;
#X connect 16 0 15 0;
#X connect 17 0 7 0;
#X connect 17 0 7 1;
#X connect 18 0 1 0;


More information about the Pd-list mailing list