Mapping one range of values to another needed range of values is a crucial technique in computer music. In this example, we want to map MIDI data values that range from 0 to 127 into a useful range for controlling the amplitude—and thus the loudness—of a sound in MSP.
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 is an example of a sampling synthesizer in Max. The kslider may be used to control the patch if a MIDI controller is not available. The gtrvoice patch used inside of the patcher guitar6strings may be found in the example Managing samples in Max. The guitar samples that are loaded into the buffer subpatch may be found in the file called guitarstrings.zip.
This patch shows different ways to receive and generate numerical values using MaxMSP.
This example shows a couple of different Jitter techniques. It shows how you can very simply use a MIDI control value to alter a Jitter attribute. In this case, the MIDI values from a modulation wheel (continuous controller 1), which range from 0 to 127, are divided by 127.0 to provide an xfade value from 0. to 1. to the jit.xfade object, to crossfade between two movie files.
This patch shows objects that are useful when working with MIDI in Max.
This patch shows the basics of displaying a movie with Jitter, and also shows the use of movie attributes to learn and use important information about the movie, how to jump around randomly within the movie, an easy way to fade the movie in or out, and how to fill the computer screen with the movie.
This example shows how to listen to a specific MIDI CC in Max for Live. Implementing MIDI reception for Max for Live is a little different from implementing it for straight ol’ Max. Instead of using, for example, the ctlin object, we need to use midiin, and then use midiselect to look for exactly what we want. Also, we need to make sure our plug-in is in a Live MIDI track, and that the MIDI monitoring is set to IN.
To get the values of only one particular continuous controller, use the ctlin object, or use the route object to parse the controller data coming out of midiparse. To change one range of values into another, use simple math (usually one multiplication and one addition will be enough), or use the scale object.
Incoming MIDI control values (0 to 127) from a ctlin object can be scaled with the scale object to cover any desired pitch range (in terms of MIDI pitch number), and that pitch range can then be converted to frequency in Hertz with the mtof MIDI to frequency object.