Forums > MaxMSP

Building a MIDI piano in Max MSP

April 3, 2011 | 4:45 pm

I’m having a slight bit of trouble building a piano controlled via a MIDI keyboard into max.

I’m a beginner at this and I’m using Max 4.5. I don’t need it to control any audio just MIDI information using Notein and noteout.

Please help


April 3, 2011 | 5:10 pm

I’ll try be more specific

"Controlling note-off with stripnote and flush
The second patch in our tutorial deals with eliminating the note-off messages received from a MIDI device and then controlling them explicitly from a patcher. In many cases, we may want to prevent a keyboard (or other MIDI input device) from turning off a note, preferring to generate the note-off programmatically. In the second patch, we route received MIDI notes from the notein object through the stripnote object, which will eliminate all note-off messages that are coming from our MIDI device. As a result, the remainder of the patch will only see note-on messages, and we will be responsible for turning the notes off when necessary.
One of the most useful tools for maintaining note-on tracking is the flush object. It will create an internal table of note-on messages that have not yet received a corresponding note-off; it can then generate note-off messages for all sustained notes whenever a bang is received in its left inlet. In this case, we are stripping all of the note-off messages, so this table will contain all of the notes that we play on our MIDI device. When we want to turn these notes off, we can hit the button object, which will send a bang message to the flush object. This will generate note-off messages for all of the played notes, then clear the internal table of notes in preparation for the next set of events. Double-click the notein object to select a valid MIDI input device; using your MIDI keyboard source, generate some notes – they will continue to sound until you click the button to flush them. We’ve also routed the notes to the Max window (using the print object) so we can see what’s going on.
Using the stripnote object to control the use of MIDI notes is useful when our playback engine needs to be sensitive to controllers other than the keyboard. Combining stripnote with flush allows us to be certain that MIDI note-off messages will be generated for any notes that were not specifically turned off."

this is in the Max tutorials. Flush is great and all but it seems to clear ALL notes. I tried using Flush with a select 0 but it allows me to hold more than 1 notes but If i let go of another. It all clears. Am I missing an object here that could help me ?

thanks guys


April 3, 2011 | 5:11 pm

Post the patch you have so far and let us know where you’re running in to trouble and we might be able to help.


April 3, 2011 | 5:58 pm

[borax] might also be of interest.


April 3, 2011 | 6:16 pm

max v2;
#N vpatcher 0 0 1280 718;
#P origin 0 36;
#P inlet 184 21 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 53 258 85 9109513 sustain;
#B color 5;
#P number 56 287 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 175 278 15 0;
#P number 129 288 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 173 252 38 9109513 ctlin 64;
#B color 5;
#P newex 127 234 41 9109513 select 0;
#P user uslider 128 156 20 33 128 1 0 0;
#P number 129 213 29 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 34 224 15 0;
#P newex 64 225 29 9109513 flush;
#P number 87 195 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 42 193 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 70 160 44 9109513 stripnote;
#P newex 119 611 47 9109513 noteout 1;
#P newex 74 49 41 9109513 notein 1;
#P connect 9 0 6 0;
#P connect 2 0 3 0;
#P connect 5 0 14 0;
#P connect 14 0 13 0;
#P connect 6 0 5 0;
#P connect 3 0 5 0;
#P connect 0 0 2 0;
#P connect 15 0 0 0;
#P connect 4 0 5 1;
#P connect 2 1 4 0;
#P connect 5 1 14 1;
#P connect 0 1 2 1;
#P connect 7 0 2 1;
#P connect 13 0 1 0;
#P connect 7 0 9 0;
#P connect 12 0 14 2;
#P connect 0 1 8 0;
#P connect 8 0 7 0;
#P connect 14 1 11 0;
#P connect 11 0 1 1;
#P connect 10 0 12 0;
#P pop;

does this help?
If not heres a link to a screenshot of it.

@Seejayjames

I tried Borax before. It seems to be completely incompatible with Stripnote.. Wouldn’t work for me anyway


April 3, 2011 | 7:19 pm

i’m kinda surprised this isn’t easier to do to be honest. I think i’m just missing something really small.


April 3, 2011 | 7:40 pm

Turns out all I needed was the Poly object :D

thanks anyway forum :)


April 6, 2011 | 12:15 am

It not possible to send you any response because on my macbook this patch create a crash of MAX 5.1.8


April 6, 2011 | 3:02 am

My midi integrator project http://cycling74.com/project/midi-integrator/ has annotated patches for processing midi keyboard input and then sending it out to a virtual synth.
Hope it helps.
Ken.


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