-
Notifications
You must be signed in to change notification settings - Fork 13
/
c_midiplay-help.pd
236 lines (236 loc) · 7.29 KB
/
c_midiplay-help.pd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#N canvas 566 324 898 520 10;
#N canvas 112 97 487 481 REFERENCE 0;
#X text 24 31 Name: [c_midiplay];
#X text 24 51 Summary: plays back a midi file to the internal midi
objects \, settable the bpm and pos;
#X text 24 434 Tags: midi \, playback \, sequencing;
#X text 24 400 See also: [midifile] [c_seqplay] [c_nstep];
#X text 24 171 Inlet 1: "bpm" <float> - beats per minute \, "loop"
<float> - loop the midi file (0-1);
#X text 24 301 Description: This is a convenience wrapper around mrpeach
[midifile] and thus requires the mrpeach external. It sends to the
internal pd midi input objects ([notein] [ctlin] etc) for you. The
bpm is calculated from the file tempo info. If the file has no bpm
and/or time sig \, then 120 & 4/4 are used as per the MIDI file specification.
;
#X text 24 273 Outlet 1: bangs on end of file \, time signature info
\, and bpm;
#X text 24 222 Outlet 0: current tick \, 4 ticks per beat calculated
from the # of midi ticks per quarter note;
#X text 24 102 Inlet 0: <float> - start stop playback \, "open" <symbol>
- open a midi file \, "reopen" - reopen the current file \, "rewind"
- rewind to file start \, "pos" <float> - set & output tick pos \,
"set" <float> - set the tick pos;
#X coords 0 -1 1 1 450 450 1 10 10;
#X restore 5 48 pd REFERENCE;
#X obj 5 18 cnv 15 450 20 empty empty empty 20 12 0 14 -261234 -66577
0;
#X text 467 51 Example:;
#X obj 502 440 soundoutput;
#X text 495 488 rc-patches (https://github.com/danomatika/rc-patches)
- 2013;
#X obj 507 79 tgl 15 0 empty empty run 17 7 0 10 -262144 -1 -1 0 1
;
#X msg 559 155 reopen;
#X floatatom 545 304 5 0 0 1 ticks - -, f 5;
#X obj 698 336 bng 15 250 50 0 empty empty end 17 7 0 10 -262144 -1
-1;
#X obj 698 207 g_hsl bpm 80 200;
#X msg 613 155 rewind;
#X text 662 155 rewind to start;
#X obj 698 242 g_tgl loop;
#X floatatom 618 229 5 0 0 1 cur_pos - -, f 5;
#X msg 481 211 bang;
#X obj 545 46 openpanel;
#X msg 545 127 open \$1;
#X msg 618 247 set \$1;
#X obj 743 365 unpack 0 0 0 0;
#X floatatom 743 398 3 0 0 1 / - -, f 3;
#X floatatom 772 398 3 0 0 1 - - -, f 3;
#X obj 698 306 route bang time_sig bpm;
#X floatatom 788 337 5 0 0 1 bpm - -, f 5;
#N canvas 770 363 414 357 show 0;
#X obj 88 82 unpack f f;
#X obj 34 328 outlet;
#X obj 61 299 outlet;
#X obj 61 270 sel 0;
#X obj 34 214 sel 0;
#X obj 61 137 *;
#X obj 88 54 inlet time sig;
#X obj 34 27 inlet ticks;
#X text 96 161 ticks per measure;
#X text 124 216 ticks per beat;
#X text 240 82 8th notes are 2 ticks;
#X text 240 106 16th notes are 1 tick;
#X text 240 127 half notes are 8 ticks;
#X text 240 148 whole notes are 16 ticks;
#X text 122 300 4/4 time is 16 ticks per measure \, 4 per beat;
#X text 121 325 3/8 time is 6 ticks per measure \, 2 per beat;
#X obj 145 114 expr 4*(4/$f1);
#X text 193 53 convert from 4 beats per measure;
#X obj 61 244 mod 3;
#X obj 34 184 mod 6;
#X floatatom 88 216 5 0 0 0 - - -, f 5;
#X floatatom 61 163 5 0 0 0 - - -, f 5;
#X connect 0 0 5 0;
#X connect 0 1 16 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X connect 4 1 18 0;
#X connect 5 0 21 0;
#X connect 6 0 0 0;
#X connect 7 0 19 0;
#X connect 16 0 20 0;
#X connect 16 0 5 1;
#X connect 18 0 3 0;
#X connect 19 0 4 0;
#X connect 20 0 18 1;
#X connect 21 0 19 1;
#X restore 545 330 pd show beat;
#X obj 743 424 pack f f;
#X obj 545 359 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 614 359 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 545 23 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X msg 631 75 symbol media/Fugue.mid;
#X text 799 398 time signature;
#X text 713 278 outputs bpm & [midifile] info;
#X msg 618 47 symbol media/billy_idol-rebel_yell.mid;
#X text 460 190 advance 1 tick;
#X msg 645 102 symbol media/test_midi.mid;
#N canvas 115 155 586 377 simple 0;
#X obj 11 33 notein;
#X floatatom 44 59 5 0 0 0 - - -, f 5;
#X floatatom 27 81 5 0 0 0 - - -, f 5;
#X floatatom 11 103 5 0 0 0 - - -, f 5;
#X obj 105 34 ctlin;
#X floatatom 132 62 5 0 0 0 - - -, f 5;
#X floatatom 118 86 5 0 0 0 - - -, f 5;
#X floatatom 105 110 5 0 0 0 - - -, f 5;
#X obj 196 34 pgmin;
#X floatatom 223 62 5 0 0 0 - - -, f 5;
#X floatatom 196 87 5 0 0 0 - - -, f 5;
#X obj 11 128 pack f f;
#X obj 11 152 list prepend;
#X obj 11 346 outlet~;
#X obj 230 347 outlet~;
#X msg 60 265 sn;
#X msg 95 265 cp;
#X msg 127 266 hh;
#X obj 11 235 sel 35 36 38 40 39 42 46;
#X msg 159 267 oh;
#X obj 11 302 s_drumelectro;
#X obj 196 236 list split 1;
#X obj 230 295 *~ 0.45;
#X obj 289 34 bendin;
#X floatatom 322 62 5 0 0 0 - - -, f 5;
#X floatatom 289 85 5 0 0 0 - - -, f 5;
#X floatatom 419 61 5 0 0 0 - - -, f 5;
#X floatatom 380 84 5 0 0 0 - - -, f 5;
#X obj 380 33 touchin;
#X floatatom 542 60 5 0 0 0 - - -, f 5;
#X floatatom 510 84 5 0 0 0 - - -, f 5;
#X floatatom 479 108 5 0 0 0 - - -, f 5;
#X obj 479 32 polytouchin;
#X obj 230 267 u_makepolymono 14 1 s_rhodey \$0-rhodeys;
#X obj 11 189 route 10 11;
#X text 188 6 recieve midi data as usual;
#X msg 11 265 bd 250;
#X text 179 152 this is a very basic general midi player;
#X text 95 193 chans 10 & 11 for drums;
#X text 281 235 instrument channels;
#N canvas 561 329 368 212 raw 0;
#X text 24 25 comment;
#X text 16 48 status byte + channels;
#X text 17 80 144 - 159: noteon;
#X text 18 96 160 - 175: poly aftertouch;
#X text 18 114 176 - 191: control change;
#X text 18 132 192 - 207: program change;
#X text 18 149 208 - 223: pitch bend;
#X text 19 165 224 - 239: aftertouch;
#X text 19 185 255 127 len data: Midi File Proprietary Event;
#X text 16 64 128 - 143: noteoff;
#X text 12 8 notes on what values are used to parse raw midi bytes
inside c_midiplay;
#X restore 441 345 pd raw midi vals;
#X connect 0 0 3 0;
#X connect 0 1 2 0;
#X connect 0 2 1 0;
#X connect 1 0 12 1;
#X connect 2 0 11 1;
#X connect 3 0 11 0;
#X connect 4 0 7 0;
#X connect 4 1 6 0;
#X connect 4 2 5 0;
#X connect 8 0 10 0;
#X connect 8 1 9 0;
#X connect 11 0 12 0;
#X connect 12 0 34 0;
#X connect 15 0 20 0;
#X connect 16 0 20 0;
#X connect 17 0 20 0;
#X connect 18 0 36 0;
#X connect 18 1 36 0;
#X connect 18 2 15 0;
#X connect 18 3 15 0;
#X connect 18 4 16 0;
#X connect 18 5 17 0;
#X connect 18 6 19 0;
#X connect 19 0 20 0;
#X connect 20 0 14 0;
#X connect 20 0 13 0;
#X connect 21 1 33 0;
#X connect 22 0 14 0;
#X connect 22 0 13 0;
#X connect 23 0 25 0;
#X connect 23 1 24 0;
#X connect 28 0 27 0;
#X connect 28 1 26 0;
#X connect 32 0 31 0;
#X connect 32 1 30 0;
#X connect 32 2 29 0;
#X connect 33 0 22 0;
#X connect 34 0 18 0;
#X connect 34 1 18 0;
#X connect 34 2 21 0;
#X connect 36 0 20 0;
#X restore 502 405 pd simple gm player;
#X text 129 21 - midifile player (requires mrpeach [midifile]);
#X text 651 127 ^ test \, has no tempo or time sig;
#X floatatom 617 184 5 0 0 1 tick_pos - -, f 5;
#X msg 617 203 pos \$1;
#X obj 545 277 c_midiplay;
#X obj 8 20 c_midiplay;
#X connect 5 0 39 0;
#X connect 6 0 39 0;
#X connect 7 0 23 0;
#X connect 9 0 12 0;
#X connect 10 0 39 0;
#X connect 12 0 39 1;
#X connect 13 0 17 0;
#X connect 14 0 39 0;
#X connect 15 0 16 0;
#X connect 16 0 39 0;
#X connect 17 0 39 0;
#X connect 18 0 19 0;
#X connect 18 1 20 0;
#X connect 19 0 24 0;
#X connect 20 0 24 1;
#X connect 21 0 8 0;
#X connect 21 1 18 0;
#X connect 21 2 22 0;
#X connect 23 0 25 0;
#X connect 23 1 26 0;
#X connect 24 0 23 1;
#X connect 27 0 15 0;
#X connect 28 0 16 0;
#X connect 31 0 16 0;
#X connect 33 0 16 0;
#X connect 34 0 3 0;
#X connect 34 1 3 1;
#X connect 37 0 38 0;
#X connect 38 0 39 0;
#X connect 39 0 7 0;
#X connect 39 1 21 0;