This chapter is for trying to put all the elements seen so far together.
To create a composition with the elements shown so far you have learned how to set up a synthesizer. You know how to set an oscillator to a certain frequency, and how to combine many of them for additive synthesis of for modulation. You know also how to set up a system for creating a sound shape, that is a time variation of amplitude, creating attack transients, the body of the sound and decay times. To operate all these mechanisms in Max you need to build algorithms, that is a way to setup instructions, actions, or calculations so that the Max patcher can assist you in your performance.
Don’t forget that Max has been designed with the idea of being a tool for expanding live performance and real-time creation of sounds. Check this article by the inventor of Max, Miller Puckette, if you want to know more about it.
Preliminaries
It is assumed here that you have already setup a sound engine of some sort, a few oscillators to produce your desired sonic material. To this, you will have to add an envelope control system (using line~ and function objects), so that the sound is not indefinitely continuous but has a defined shape.
Mechanics of performance
To play a sound that has an amplitude control (setup with the function object), you just need to trigger the function object with a bang. When you want to trigger more sounds at the same time or by very fast sequences, it could be a problem in Max.
Have a look at this patcher:
It shows three ways of playing a sound. From left to right, simply with a bang, using the key object, and using the kslider object.
bang
Triggering a bang is straightforward. You have to select it with the mouse before clicking on it. So it takes time. You should already be aware that other objects can trigger bangs: metro, trigger, select, for example. These can help you multiply the number of bangs you can trigger at any one time, therefore making your performance potentially richer.
key
This object is interesting as it allows you to get rid of the mouse, and rely on the keyboard of your computer for triggering sounds. It reads each character you type on your keyboard and gives back the corresponding numerical value, based on key-codes in ASCII values. Once you have numbers, you can use many objects in Max to interact with your keyboard. The most common one is to use a select object to track for a specific number and triggering a bang if that number is detected. So if I set select on 32, which is the ASCII value for the spacebar, everytime I press the spacebar, I will be able to trigger a bang.
This technique not only opens up to having multiple keys to trigger multiple sounds but also to use keys to direct bangs, via switches and data routing operators, to different parts of your patcher, accordingly to your performance idea.
kslider
This object is a replication of a piano keyboard in your patcher. If you click on it with the mouse, it will trigger out midi notes (left outlet) and velocity values (right outlet). These values can be converted to frequencies values with the mtof object, if you need to do so. Conveniently using a trigger object, you can use kslider generated numbers to trigger sounds, also providing two extra bits of information, which are the pitch and the velocity. These can also be used in different ways, like changing oscillators frequency values or scaled to be working with amplitude control objects such as gain~ or *~.
How to apply actions
You have seen in Lesson 4 how to program actions. This paragraphs should give you some guidelines to how to use them effectively for your performance.
The most obvious thing an action can be connected to is volume control. We have seen that with the function object connected to line~: in the function object it is possible to specify the different arrival points and time, and when triggered, line~ object takes care of delivering it into a progressive sequence of commands, a ramp, which performs the action.
The function object can be set to different time values through the setdomain message commands…
pitch changes using function
mini instant ramps