Creating MIDI Effects
Max for Live lets you create MIDI effects devices which receive MIDI information from the Live application, perform some operation on that data (e.g. mapping incoming notes to a user-definied musical scale), and then pass MIDI data downstream to another MIDI effect or to a MIDI Instrument - the last device in a MIDI effects chain (although the audio output of the instrument may be further processed by any number of Audio effects devices).
By convention, Max for Live gets all its MIDI data from the Live application using the midiin object, and all of that data must all be passed downstream to other MIDI devices by means of the midiout object. Max for Live provides a means to redirect portions of an incoming MIDI data stream for processing while leaving the rest of the stream unchanged, as described below.
Also by convention, all Max for Live MIDI devices receive audio on MIDI channel 1. You can receive receive MIDI data in your Max for Live MIDI Effects device on a channel number other than 1 by routing the MIDI input as described here.
Max for Live provides several tutorials and example MIDI effects devices you can try, study, and modify:
Capturing a portion of the MIDI data stream in Max for Live
Max for Live requires that all MIDI data coming into a MIDI Effects device be passed downstream. There are situations in which you may want to use only a portion of the incoming MIDI data stream - to select only MIDI notes in a given range, or input from specific MIDI continuous controllers for use in your device. The Max midiselect object lets you specify portions of an incoming MIDI data stream to filter out for further processing in your device, and passes any other MIDI data out unchanged.

Redirecting a part of a MIDI data stream