You can use a MIDI "program change" message to tell a synthesizer to change to a different sound. The Max object for that is pgmout.
These patches use timed counting—in both cases using a metro object and a counter—to step through a series of MIDI notes.
Max has dedicated objects for parsing each particular type of MIDI channel message coming into the computer, such as notes, pitchbends, controllers, etc., and it has corresponding output objects for formatting and transmitting MIDI messages to be sent out of Max.
This patch shows how to create a linear crescendo using MIDI velocity.
This patch demonstrates how to implement your computer keyboard as a MIDI controller.
This patch demonstrates a couple of very simple sorts of transformations that could be imposed on incoming MIDI pitch values before sending them on to a synthesizer. One is transposition, achieved by adding a certain number of semitones to the MIDI pitch value (and sending it out with the same velocity values as were in the incoming note messages).
This patch shows objects that are useful when working with MIDI in Max.
Here are three ways of generating MIDI notes. Admittedly they don't result in very interesting music, but they show ways how numbers can be converted for usage as pitch information.