Forums > MaxMSP

Using MIDI within a poly~


Al
April 3, 2006 | 7:54 pm

Hi,

I can’t seem to find any help with this in the tutorial files. I’ve set up a tri~ in a poly~ with two voices. I’m using a MIDI notein to trigger the tri~.

So I unpack the data within the poly~ and it plays a seperate note in each instance fine, however the problem is that the correct instance will never receive a noteoff message. Do I have to use ‘target’ for each noteon and noteoff message and keep a track of which instance is in use manually or is there a way for the poly~ to automatically send the correct noteoff to the correct instance?

Hopefully my explaination wasn’t too bad there.

Cheers,
Al.


April 3, 2006 | 8:07 pm

Quote: Al wrote on Mon, 03 April 2006 12:54
—————————————————-

>
> So I unpack the data within the poly~

…but your "notein" is outside the poly~, yes?

>Do I have to use ‘target’ for each noteon and noteoff message and keep a track of which instance is in use manually or is there a way for the poly~ to automatically send the correct noteoff to the correct instance?
>

right. Use poly (no ~) or Borax to manage this for you.

mz



Al
April 3, 2006 | 8:54 pm

It seems to me to be impossible to target an instance that is busy although most probably I have done something wrong. I have used the ‘poly’ object to find the voice number. I then use a ‘set target $1′ messagebox to create a messagebox with the correct target number in it. My Midi note information is held in another messagebox and I use a ‘t b b’ to bang the target message first and the note information second but I still can’t seem to get noteoffs to work.

Cheers for the help,

Al.


April 3, 2006 | 9:00 pm

Quote: Al wrote on Mon, 03 April 2006 13:54
—————————————————-
> It seems to me to be impossible to target an instance that is busy although most probably I have done something wrong. I have used the ‘poly’ object to find the voice number. I then use a ‘set target $1′ messagebox to create a messagebox with the correct target number in it. My Midi note information is held in another messagebox and I use a ‘t b b’ to bang the target message first and the note information second but I still can’t seem to get noteoffs to work.
>
> Cheers for the help,
>
> Al.
—————————————————-

Busy poly~’s ignore the messages "note" and "midinote". You’ll need to send your noteoff as some other message.

Post a patch?

mzed



Al
April 3, 2006 | 9:33 pm

I think the target numbers can’t be working correctly. There’s probably a far simpler way of doing this:

_____________
Maxsynth.pat
_____________

max v2;
#N vpatcher 604 303 1204 873;
#P origin 90 -48;
#P window setfont "Sans Serif" 9.;
#P newex 313 188 57 9109513 prepend set;
#P message 313 253 30 9109513 0;
#P newex 136 186 57 9109513 prepend set;
#P button 79 180 15 0;
#P newex 79 215 40 9109513 t b b b;
#P message 136 251 30 9109513 65;
#P message 8 253 52 9109513 target 1;
#P number 231 156 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 298 156 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 8 151 61 9109513 set target $1;
#P newex 122 105 53 9109513 poly 2;
#P message 259 263 36 9109513 open 2;
#P message 212 263 36 9109513 open 1;
#P newex 122 77 44 9109513 pack 0 0;
#P user meter~ 114 366 194 379 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user ezdac~ 59 362 103 395 0;
#P newex 122 21 40 9109513 notein;
#P newex 87 301 87 9109513 poly~ triangleosc 2;
#P comment 240 138 31 9109513 pitch;
#P comment 307 138 48 9109513 velocity;
#P comment 354 253 19 9109513 vel;
#P comment 170 252 27 9109513 pitch;
#P fasten 11 0 12 0 127 137 13 137;
#P fasten 17 2 15 0 114 243 13 243;
#P connect 12 0 15 0;
#P connect 4 0 6 0;
#P fasten 12 0 18 0 13 174 84 174;
#P connect 18 0 17 0;
#P fasten 10 0 4 0 264 290 92 290;
#P fasten 9 0 4 0 217 290 92 290;
#P fasten 15 0 4 0 13 285 92 285;
#P fasten 16 0 4 0 141 285 92 285;
#P connect 4 0 6 1;
#P connect 4 0 7 0;
#P connect 5 0 8 0;
#P connect 8 0 11 0;
#P connect 11 1 19 0;
#P fasten 17 1 16 0 99 248 141 248;
#P lcolor 12;
#P connect 19 0 16 0;
#P fasten 5 1 8 1 142 58 161 58;
#P fasten 20 0 4 1 318 295 169 295;
#P fasten 11 1 14 0 141 140 236 140;
#P fasten 11 2 13 0 155 132 303 132;
#P fasten 11 2 21 0 155 180 318 180;
#P lcolor 8;
#P fasten 17 0 20 0 84 238 318 238;
#P lcolor 15;
#P connect 21 0 20 0;
#P pop;

________________
triangleosc.pat
________________

max v2;
#N vpatcher 105 94 1115 749;
#P origin 47 -1;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N in 2;
#X comment velocity in;
#P newobj 329 54 23 9109513 in 2;
#P window linecount 0;
#P message 46 181 50 9109513;
#P window linecount 1;
#P newex 46 134 57 9109513 prepend set;
#P message 512 247 48 9109513 mute 1 , 0;
#P button 586 216 15 0;
#P button 483 218 15 0;
#P flonum 361 146 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 427 381 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 372 382 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 441 246 48 9109513 mute 0 , 1;
#P newex 441 177 155 9109513 if $f1 > 0 then bang else out2 bang;
#P user meter~ 249 361 329 374 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P newex 329 100 79 9109513 scale 0 127 0. 1.;
#N out~ 1;
#P newobj 206 342 34 9109513 out~ 1;
#P newex 378 340 46 9109513 thispoly~;
#P newex 206 292 33 9109513 *~ 0.;
#P newex 206 239 40 9109513 tri~;
#P newex 206 207 28 9109513 mtof;
#N in 1;
#X comment pitch in;
#P newobj 206 54 23 9109513 in 1;
#P comment 201 36 41 9109513 pitch;
#P comment 319 36 45 9109513 velocity;
#P fasten 2 0 18 0 211 103 51 103;
#P connect 18 0 19 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 7 0;
#P fasten 8 0 5 1 334 274 234 274;
#P connect 5 0 9 0;
#P connect 20 0 8 0;
#P fasten 8 0 14 0 334 132 366 132;
#P connect 6 0 12 0;
#P fasten 11 0 6 0 446 301 383 301;
#P fasten 17 0 6 0 517 302 383 302;
#P connect 6 1 13 0;
#P fasten 14 0 10 0 366 169 446 169;
#P connect 10 0 11 0;
#P fasten 10 0 15 0 446 207 488 207;
#P fasten 10 1 17 0 591 205 517 205;
#P connect 10 1 16 0;
#P pop;


April 3, 2006 | 9:46 pm

Here’s the outside patch:

#P window setfont "Sans Serif" 9.;
#P number 34 134 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 95 154 57 196617 pack 0 0 0;
#P message 95 181 87 196617 target $1 , $2 $3;
#P message 321 253 30 196617 24;
#P number 231 156 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 298 156 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 95 110 81 196617 poly 2;
#P message 267 263 36 196617 open 2;
#P message 220 263 36 196617 open 1;
#P newex 95 82 44 196617 pack 0 0;
#P user meter~ 122 366 202 379 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user ezdac~ 67 362 111 395 0;
#P newex 95 26 40 196617 notein;
#P newex 95 301 97 196617 poly~ triangleosc 2;
#P comment 240 138 31 196617 pitch;
#P comment 307 138 48 196617 velocity;
#P comment 362 253 19 196617 vel;
#P connect 3 0 5 0;
#P connect 3 0 5 1;
#P connect 3 0 6 0;
#P connect 10 2 15 2;
#P fasten 10 2 11 0 146 132 303 132;
#P connect 10 1 15 1;
#P fasten 10 1 12 0 123 140 236 140;
#P connect 10 0 16 0;
#P connect 10 0 15 0;
#P connect 14 0 3 0;
#P fasten 9 0 3 0 272 290 100 290;
#P fasten 8 0 3 0 225 290 100 290;
#P connect 15 0 14 0;
#P connect 4 0 7 0;
#P connect 7 0 10 0;
#P fasten 4 1 7 1 115 63 134 63;
#P fasten 13 0 3 1 326 295 187 295;
#P window clipboard copycount 17;


April 3, 2006 | 9:47 pm

triangleosc.pat:

#P toggle 468 197 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 420 201 41 196617 sel 0 1;
#P number 220 119 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 262 120 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 206 83 58 196617 unpack 0 0;
#N in 2;
#X comment velocity in;
#P newobj 329 54 23 196617 in 2;
#P message 380 245 62 196617 mute 1 , 0;
#P flonum 362 155 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 427 381 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 372 382 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 451 250 62 196617 mute 0 , 1;
#P newex 420 176 27 196617 > 0.;
#P user meter~ 249 361 329 374 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P newex 329 103 93 196617 scale 0 127 0. 1.;
#N out~ 1;
#P newobj 206 342 34 196617 out~ 1;
#P newex 378 340 60 196617 thispoly~;
#P newex 206 292 33 196617 *~ 0.;
#P newex 206 239 40 196617 tri~;
#P newex 206 207 28 196617 mtof;
#N in 1;
#X comment pitch in;
#P newobj 206 54 23 196617 in 1;
#P comment 201 36 41 196617 pitch;
#P comment 319 36 45 196617 velocity;
#P connect 10 0 20 0;
#P connect 10 0 21 0;
#P connect 20 1 11 0;
#P connect 6 1 13 0;
#P fasten 8 0 5 1 334 274 234 274;
#P fasten 8 0 14 0 334 132 367 132;
#P connect 8 0 10 0;
#P connect 20 0 15 0;
#P fasten 11 0 6 0 456 301 383 301;
#P fasten 15 0 6 0 385 302 383 302;
#P connect 6 0 12 0;
#P connect 17 1 18 0;
#P connect 17 1 8 0;
#P connect 16 0 8 0;
#P connect 5 0 7 0;
#P connect 5 0 9 0;
#P connect 17 0 3 0;
#P connect 17 0 19 0;
#P connect 4 0 5 0;
#P connect 3 0 4 0;
#P connect 2 0 17 0;
#P window clipboard copycount 22;



Al
April 3, 2006 | 10:02 pm

That’s great, very neat. So simple really, should have thought about it before.

Thanks alot!

Al.


April 5, 2006 | 9:10 am

Alistair wrote:
> That’s great, very neat. So simple really, should have thought about it before.

But still, it could be much much simpler, all the polyphony handling is
built into poly~…

simplified triangleosc:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 48 195 33 196617 pass~;
#P newex 140 146 66 196617 sel 0;
#P newex 48 86 58 196617 unpack 0 0;
#N in 2;
#X comment velocity in;
#P newobj 140 58 23 196617 in 2;
#P message 140 171 54 196617 mute 1 , 0;
#P number 190 225 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 140 226 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 196 171 54 196617 mute 0 , 1;
#P newex 96 146 41 196617 / 127.;
#N out~ 1;
#P newobj 48 221 34 196617 out~ 1;
#P newex 140 197 60 196617 thispoly~;
#P newex 48 171 58 196617 *~ 0.;
#P newex 48 146 33 196617 tri~;
#P newex 48 114 33 196617 mtof;
#N in 1;
#X comment pitch in;
#P newobj 48 57 23 196617 in 1;
#P comment 43 39 41 196617 pitch;
#P comment 130 40 45 196617 velocity;
#P connect 14 1 8 0;
#P connect 14 1 15 0;
#P connect 13 0 8 0;
#P connect 13 0 15 0;
#P connect 12 0 6 0;
#P fasten 9 0 6 0 201 191 145 191;
#P connect 8 0 5 1;
#P connect 5 0 16 0;
#P connect 16 0 7 0;
#P connect 15 1 9 0;
#P connect 15 0 12 0;
#P connect 2 0 14 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 14 0 3 0;
#P connect 6 0 10 0;
#P connect 6 1 11 0;
#P window clipboard copycount 17;

simplified main patcher:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 38 112 44 196617 steal 1;
#P message 269 111 30 196617 24;
#P newex 95 110 81 196617 prepend midinote;
#P message 229 111 36 196617 open 2;
#P message 182 111 36 196617 open 1;
#P newex 95 82 44 196617 pack;
#P user meter~ 122 214 202 227 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user ezdac~ 67 210 111 243 0;
#P newex 95 26 40 196617 notein;
#P newex 95 149 97 196617 poly~ triangleosc 2;
#P comment 310 111 19 196617 vel;
#P connect 10 0 1 0;
#P connect 1 0 3 0;
#P connect 1 0 3 1;
#P connect 1 0 4 0;
#P connect 8 0 1 0;
#P connect 2 0 5 0;
#P fasten 2 1 5 1 115 63 134 63;
#P connect 5 0 8 0;
#P fasten 9 0 1 1 274 143 187 143;
#P fasten 6 0 1 0 187 138 100 138;
#P fasten 7 0 1 0 234 138 100 138;
#P window clipboard copycount 11;

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09


Viewing 9 posts - 1 through 9 (of 9 total)