[PD] Writing a MIDI file...or at least a qlist...to disc

Frank Barknecht fbar at footils.org
Wed Oct 11 23:14:11 CEST 2006


Hallo,
Richard Bowers hat gesagt: // Richard Bowers wrote:

> Basically, I'm running a PD patch on a Mac which is sending (internally,
> not through hardware) MIDI note on/off pairs to another program
> (Arkaos). I would like to be able to capture the MIDI stream within PD
> (or the numeric values on which the MIDI notes are based) into a file
> for later retrieval. So
>  
> 1) is there a purpose-built object which will handle this? or
>  
> 2) can a file be written to disc as a qlist? If so, could someone
> describe how to write such a file?

You can write a qlist's content using "write FILENAME", but I guess,
you know this already. The important thing to remember with qlist is
that it stores lists conisting of at least three elements: First the
"Inter Onset Interval" or IOI, which is the time between successive
events, then the name of a receiver, which receives the qlist data, if
the qlist is playing back, and after that the actual data to record: 

qlist: IOI receiver data ...

"data" can be a list itself, in your case it is a note events
consisting of note number and velocities. Then you need to build the
other two elements: Just decide on a receiver name (attached patch
uses "NOTEIN") and calculate the IOI. IOI-calculation is very simply
done by double-banging a [timer]: 

 "events, events, ..."
 |
 [t b b]
 |     |
 [timer]
 |
 "IOI"

At the start of a recording, you should reset the [timer] to 0 through
its left(!) inlet, and you should "clear" the qlist.

Attached is a working example, but maybe you want to try to build a
qlist-recorder on your own first. It shouldn't be too hard if you
follow the hints above.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 410 334 666 475 10;
#X obj 89 361 qlist;
#X obj 89 29 notein;
#X obj 89 280 list trim;
#X obj 89 258 list prepend add;
#X obj 89 113 t a b;
#X obj 89 217 list prepend 0;
#X obj 89 86 list prepend NOTEIN;
#X obj 362 335 r NOTEIN;
#X obj 362 364 print qlist_playback;
#X msg 362 205 write \$1;
#X obj 362 148 bng 15 250 50 0 empty empty save 17 7 0 10 -225271 -1
-1;
#X obj 452 148 bng 15 250 50 0 empty empty load 17 7 0 10 -262131 -1
-1;
#X obj 362 184 savepanel;
#X obj 452 184 openpanel;
#X msg 452 205 read \$1;
#X obj 540 150 bng 15 250 50 0 empty empty play 17 7 0 10 -1 -262144
-1;
#X msg 540 203 rewind \, bang;
#X obj 290 149 bng 15 250 50 0 empty empty rec 17 7 0 10 -258699 -1
-1;
#X msg 254 344 print;
#X msg 290 203 clear;
#X obj 182 172 t b b;
#X obj 182 195 timer;
#X text 136 183 IOI:;
#X obj 89 59 pack 0 0;
#X msg 220 62 30 0;
#X msg 219 40 30 100;
#X text 210 19 Test "notes";
#X obj 119 383 bng 15 250 50 0 empty empty FIN 17 7 1 10 -262144 -1
-1;
#X msg 187 344 rewind;
#X connect 0 1 27 0;
#X connect 1 0 23 0;
#X connect 1 1 23 1;
#X connect 2 0 0 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
#X connect 4 1 20 0;
#X connect 5 0 3 0;
#X connect 6 0 4 0;
#X connect 7 0 8 0;
#X connect 9 0 0 0;
#X connect 10 0 12 0;
#X connect 11 0 13 0;
#X connect 12 0 9 0;
#X connect 13 0 14 0;
#X connect 14 0 0 0;
#X connect 15 0 16 0;
#X connect 16 0 0 0;
#X connect 17 0 19 0;
#X connect 17 0 21 0;
#X connect 18 0 0 0;
#X connect 19 0 0 0;
#X connect 20 0 21 0;
#X connect 20 1 21 1;
#X connect 21 0 5 1;
#X connect 23 0 6 0;
#X connect 24 0 6 0;
#X connect 25 0 6 0;
#X connect 28 0 0 0;


More information about the Pd-list mailing list