Reconnecting a midi keyboard

Feb 27, 2008 at 1:19pm

Reconnecting a midi keyboard

Hi pals,

I am working on something that I want my Max program running, while plug-and-unplug occasionally with a USB MIDI keyboard, that it can work and send notes to the computer.

It seems to be fine in some of the software to support a hot-swap of MIDI keyboard, but not in Max/MSP.

I have a little patch below which help me to test.

If I plug in the keyboard, start the patch. The keyboard will be working. Then I unplug it and plug it in again, no error message, but the keyboard is now lose.

The only way to ‘awaken’ it is restart the Max/MSP environment.

I have already assign an abev. to the keyboard in ‘midi setip..’, but still no luck.

Any light ?

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 197 279 40 9109513 noteout;
#B color 5;
#P message 287 245 35 9109513 60 0;
#P message 278 222 41 9109513 60 80;
#P comment 226 223 48 9109513 note-on;
#P comment 225 245 50 9109513 note-off;
#P comment 114 148 30 9109513 pitch;
#P comment 147 148 47 9109513 velocity;
#P number 149 131 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 113 131 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 197 94 67 9109513 notein a;
#B color 5;
#P newex 197 147 38 9109513 pack i i;
#P connect 1 1 3 0;
#P connect 1 1 0 1;
#P fasten 8 0 10 0 283 270 202 270;
#P fasten 9 0 10 0 292 270 202 270;
#P connect 0 0 10 0;
#P connect 1 0 2 0;
#P connect 1 0 0 0;
#P window clipboard copycount 11;

William

#36074
Feb 27, 2008 at 2:41pm

my experience (on windows xp, though i’m not sure if that matters) is that programs request access to midi devices on startup only. so, unfortunately, you need to restart max every time your setup changes (assuming you want to continue using midi).
a potential solution is to use a midi loopback driver (like midiyoke or maple) and use only the loopback port in max. since the loopback “device” is never disconnected, you’ll never have a problem with it in max. then you can have your keyboard route (via something like midiox) to whichever loopback port you’re using. so when you disconnect/reconnect the keyboard, you’ll only need to restart the routing program, and not max.

#123528

You must be logged in to reply to this topic.