repnote.pat

Aug 3, 2007 at 11:15pm

repnote.pat

hi,
this is a patch from the max/msp exemples :

This patch work well with direct repeated note but what about the others ??
I mean if during the makenote duration you sends a note then another one then the same as the first one, the third note will be trunced because of the first note-off message.
Any idea about this ???

max v2;
#N vpatcher 10 33 1271 353;
#P origin 25 -3;
#P window setfont “Sans Serif” 9.;
#P message 496 120 18 9109513 80;
#P window setfont “Sans Serif” 36.;
#P window linecount 3;
#P comment 702 37 209 9109540 !!!! work only with direct repetitions;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 704 212 232 9109513 try 60 then 80 then 60 , the second 60 will be trunced;
#P window setfont “Sans Serif” 14.;
#P comment 471 23 110 791478286 with repnote;
#P window setfont “Sans Serif” 9.;
#P comment 353 197 88 196617 ..you get staccato;
#P toggle 415 219 27 0;
#P newex 247 146 64 196617 pack 60 127;
#P newex 247 201 98 196617 makenote 127 1100;
#P message 247 121 20 196617 60;
#P toggle 247 75 15 0;
#P newex 247 98 62 196617 metro 1000;
#P button 394 252 15 0;
#P button 335 251 15 0;
#P newex 335 228 69 196617 sel 0;
#P comment 394 274 35 196617 noteon;
#P comment 335 274 40 196617 noteoff;
#P toggle 647 219 27 0;
#P newex 473 146 64 196617 pack 60 127;
#P newex 473 201 98 196617 makenote 127 1100;
#P message 473 121 20 196617 60;
#P toggle 473 75 15 0;
#P newex 473 98 62 196617 metro 1000;
#P button 620 252 15 0;
#P button 561 251 15 0;
#P newex 561 228 69 196617 sel 0;
#P newex 473 180 42 196617 repnote;
#B color 14;
#P window setfont “Sans Serif” 20.;
#P comment 127 21 98 791478292 repnote;
#P window setfont “Sans Serif” 9.;
#P window linecount 13;
#P comment 0 67 213 196617 Repeated notes can be a problem because MIDI was designed for keyboards. That is , each repeated note-on is automatically preceded by a note-off (because the key must be physically lifted before it can be played again). With a Max program generating the notes , it is possible to generate two notes of long duration separated by a short amount of time. The result: makenote sends the note-off for the first note during the second note , and the second note ends up being too short. This patcher is designed to precede makenote and add that little “key up” when a note is repeated.;
#P window linecount 1;
#P comment 620 274 35 196617 noteon;
#P comment 561 274 40 196617 noteoff;
#P comment 317 84 100 196617 you wanted legato..;
#P comment 274 124 166 196617 …but those repeated notes mean…;
#P window setfont “Sans Serif” 14.;
#P comment 242 23 134 791478286 without repnote;
#P window setfont “Sans Serif” 9.;
#P comment 176 54 29 196617 – les;
#P connect 24 0 23 0;
#P connect 23 0 25 0;
#P connect 25 0 27 0;
#P connect 27 0 26 0;
#P connect 26 1 20 0;
#P connect 20 0 21 0;
#P connect 20 1 22 0;
#P connect 26 1 28 0;
#P connect 13 0 12 0;
#P connect 12 0 14 0;
#P fasten 33 0 16 0 501 140 478 140;
#P connect 14 0 16 0;
#P connect 16 0 8 0;
#P connect 8 0 15 0;
#P connect 15 1 9 0;
#P connect 9 0 10 0;
#P connect 9 1 11 0;
#P connect 15 1 17 0;
#P pop;

#33151
Aug 4, 2007 at 1:34am

Does this do what you need? One potential issue with this solution is it doesn’t send all the noteoffs. But if a single noteoff is sufficient for turning off repeated noteons to the same pitch, this should work.

Adam

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 106 166 40 196617 print;
#N vpatcher 457 126 957 511;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 230 213 41 196617 select 0;
#P newex 294 273 46 196617 append 0;
#P newex 340 111 44 196617 pack 0 0;
#P newex 294 248 27 196617 int;
#P newex 340 85 58 196617 stripnote;
#P newex 158 197 27 196617 t b i;
#P newex 139 269 44 196617 pack 0 0;
#P newex 139 244 27 196617 int;
#P newex 103 79 27 196617 t i i;
#P newex 168 168 27 196617 + 1;
#P newex 185 87 123 196617 if $i1==0 then -1 else 1;
#N vtable 128 15 55 225 222 4 128;
#P newobj 103 123 28 196617 table;
#P inlet 103 37 15 0;
#P inlet 185 36 15 0;
#P outlet 340 322 15 0;
#P window linecount 3;
#P comment 193 110 100 196617 add 1 for noteons , subtrace 1 for noteoffs;
#P comment 23 132 100 196617 the table counts noteons for each midi note number;
#P window linecount 5;
#P comment 205 251 91 196617 when the noteon count gets back to 0 , output the noteoff for this midi note number;
#P window linecount 3;
#P comment 85 245 51 196617 update the count in the table;
#P window linecount 1;
#P comment 20 36 100 196617 midi note number;
#P comment 202 36 100 196617 velocity;
#P window linecount 2;
#P comment 401 96 73 196617 pass through all noteons;
#P connect 9 0 13 0;
#P connect 13 0 10 0;
#P fasten 15 0 10 0 144 293 16 293 16 113 108 113;
#P connect 16 0 14 0;
#P connect 14 0 15 0;
#P connect 13 1 14 1;
#P connect 12 0 16 0;
#P connect 10 0 12 0;
#P connect 16 1 15 1;
#P connect 8 0 11 0;
#P connect 11 0 12 1;
#P connect 12 0 21 0;
#P connect 21 0 18 0;
#P connect 18 0 20 0;
#P connect 13 1 18 1;
#P connect 9 0 17 0;
#P connect 17 0 19 0;
#P connect 19 0 7 0;
#P connect 20 0 7 0;
#P connect 8 0 17 1;
#P connect 17 1 19 1;
#P pop 1;
#P newobj 38 126 83 196617 p noteoff-filter;
#P newex 38 171 40 196617 noteout;
#P newex 38 95 104 196617 makenote 127 1100;
#P message 62 40 18 196617 80;
#P message 38 39 20 196617 60;
#P window linecount 3;
#P comment 90 37 100 196617 hit 60-80-60 quickly and watch the max window;
#P connect 1 0 3 0;
#P connect 2 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 3 1 5 1;
#P connect 5 0 6 0;
#P window clipboard copycount 7;

#109991
Aug 4, 2007 at 2:28am

Thanks Adam, it seems to work.
I was also thinking about a solution with poly~
What do you think about it ??

______________________________________________
master patch
______________________________________________

max v2;
#N vpatcher 316 81 494 297;
#P origin 25 -3;
#P window setfont “Sans Serif” 9.;
#P newex 23 163 26 9109513 print;
#P newex 23 137 98 9109513 pack;
#P newex 56 85 68 9109513 prepend target;
#P newex 23 61 43 9109513 t i i;
#P message 45 33 18 9109513 80;
#P message 23 33 20 9109513 60;
#P newex 23 113 98 9109513 poly~ makenote 127;
#B color 14;
#P connect 1 0 3 0;
#P connect 2 0 3 0;
#P connect 3 0 0 0;
#P fasten 4 0 0 0 61 107 28 107;
#P connect 0 0 5 0;
#P connect 5 0 6 0;
#P connect 3 1 4 0;
#P connect 0 1 5 1;
#P pop;

______________________________________________
poly~ : makenote
______________________________________________

max v2;
#N vpatcher 117 149 328 332;
#P origin 0 14;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N out 2;
#P newobj 125 135 29 9109513 out 2;
#N in 3;
#P newobj 125 41 23 9109513 in 3;
#N in 2;
#P newobj 77 41 23 9109513 in 2;
#P newex 29 67 37 9109513 t i stop;
#P newex 29 106 106 9109513 makenote 127 2000;
#N out 1;
#P newobj 29 135 29 9109513 out 1;
#N in 1;
#P newobj 29 41 23 9109513 in 1;
#P connect 0 0 3 0;
#P connect 3 0 2 0;
#P fasten 3 1 2 0 61 97 34 97;
#P connect 2 0 1 0;
#P connect 4 0 2 1;
#P connect 5 0 2 2;
#P connect 2 1 6 0;
#P pop;

#109992
Aug 5, 2007 at 4:42am

I think your poly~ patch is going to be the right thing to use. I barely used the patch I posted, but now I tried hooking both up to a couple synthesizers and it seems mine will leave notes stuck on.

I think there’s a fundamental limitation in midi we’re seeing here. If you send pitch/velocity messages like: “60 100″, “60 100″, “60 0″, “60 0″. It looks like the synthesizer is going to interpret that as note 1 on, note 2 on, note 2 off, note 1 off. At least, that’s what I am hearing if I hook up the original patch you posted to a noteout and listen to it.

Your solution works because you turn off repeated notes before triggering them again. That is probably the safest thing to do. But I wonder if it’s possible to get note 1 on, note 2 on, *note 1 off*, note 2 off when re-triggering the same note. One option might be to use poly to send notes to different channels and assign the same sound to every channel. But that doesn’t sound like a great solution either.

-Adam

#109993
Aug 7, 2007 at 9:35pm

dGarden schrieb:
> Thanks Adam, it seems to work.
> I was also thinking about a solution with poly~
> What do you think about it ??

The whole issue is entirely dependent on the receiving synth!

The suggested method of Adam will create a stuck note on better synths,
and those will switch off the first note which had been switched on.
This is probably mainly an issue with monophonic synths or synths with
bad voice allocation…

poly~ should do it correctly…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#109994

You must be logged in to reply to this topic.