Synth-Building with Max/MSP #5

    This series of tutorials first appeared on my website between 2001 and 2002. Due to their popularity (especially amongst new Max users), I have moved them to the website. Read the introduction.
    OK - we've built the voice patch for a poly~ object, now we have to turn it into a legitimate polyphonic synth. Here is our "master patch" (as found in the last tutorial, which you can download from this link):

    Tutorial Series

    While it doesn't much look like the tutorial 3 patch, it maintains all of the functionality of that machine - but is now a 16-voice version. Let's look at each section of the synth...
    In our earlier patch, we used notein and ddg.mono to simplify midi handling. While we could still use notein, I've decided to use midiin instead (you'll see why in the next tutorial). I also append the "a" identifier to midiin - this allows me to automatically use whatever MIDI device I've got assigns as the "a" device without the hassle of selecting an OMS input.
    Using midiparse, we can get the note-on and note-off events that are coming in from the midiin object. In order for poly~ to understand the meaning of these note events, we need to prepend the symbol "midinote" to the note number and velocity. This combo gets sent to the left input of the poly~ object.
    Next, all of the user interface objects get sent to the poly~ object:
    One point about user interface elements - they actually have to get sent to all instances of the voice patch. To do this, we have to send the message "target 0" to poly~ - this is a signal that all voice patches get the message, as opposed to the current voice. This is done by using the trigger (abbreviated as "t") to first bang the "target 0" message, then send the remainder of the UI values to poly~.
    The poly~ object is instantiated with the name of the voice patch ("cs_04_voice", which is what we called the patch), and the number of voices to create. One other detail: we need to tell poly~ to implement voice stealing. This is done with a loadbang object hitting the "steal 1" message. This tells poly~ that voice stealing should be used...
    Finally, the output of poly~ (from the out~ object in our voice patch) is sent to a signal fader, the clip~ object and ezdac~, just as with our original patch. One nice feature of poly~ is that it outputs a mixed signal of all 16 voices - no further mixing is required by our patch.
    So, there we have it. A 16-voice polysynth out of the dregs of a monosynth. Hopefully, this helps you see the power of poly~, the ease of creating a polysynth and gets you excited about making your own poly-monsters.
    Darwin Grosse