Programming:
Step 1 – Creating the Buffer
The first step is to create a place to store your waveform.
In Max, this is done with the buffer~ object.
1. Create a new Max patch.
2. Add an object:
This creates a buffer named waveform with 24 samples.
3. Add a waveform~ object to visualize the buffer:
You should now see an empty waveform display.
Step 2 – Connecting MIDI Controller
Now let’s bring data from your MC-24 controller.
1. Add a ctlin object to receive MIDI Control Change messages:
This listens for CC numbers 1–24.
2. Scale MIDI values (0–127) to a usable range of –1 to 1:
3. Pack the CC index and its scaled value together.
Pack — Combine Items into an Output List.
- This object is used to merge multiple data streams into a single list.
- I in pack indicates that the input expects integers.
- F indicates that the input expects floating-point numbers.
- Example: pack I F — the first inlet takes integers, the second inlet takes floats, and the object outputs a combined list [int float].
4. Prepend the word “set” to tell the buffer which index to update:
Prepend — Add a message in front of input.
- We use prepend with the word “set” to send a specific message to a multislider.
- This allows us to target a particular slider in the multislider and change its value.
- In our patch, the multislider is used to shape the waveform, so prepend set is essential for updating individual sliders dynamically.
Step 3 – Writing Values into the Buffer
Now we’ll take each knob’s value and write it into the buffer.
1. Create a zl.lookup object to access values by index.
2. Use a poke~ waveform object to write data into the buffer.
3. Add a uzi 24 0 object to iterate through all 24 points when needed.
4. Use a t b l (trigger) object to make sure messages are sent in the correct order.
This combination ensures that when any knob moves, its value is stored in the correct sample index of the waveform buffer.
Step 4 – Using the Waveform as a Sound Source
Now that you have a waveform stored in the buffer, you can play it as a sound.
1. Add a phasor~ 1. object — this generates a ramp from 0 to 1.
It acts as a “read head” that scans through the waveform.
2. Use the wave~ waveform object to read the buffer continuously.
3. Connect the output of wave~ to plugout~ or dac~ to hear it.
When you move the knobs on your MC-24, the waveform changes, and you’ll instantly hear the sound morph.
Step 5 – Playing Notes from a Keyboard
To make it more musical, let’s add a MIDI keyboard.
1. Create a virtual keyboard by adding the kslider object.
2. Connect the output of kslider to mtof to convert MIDI note numbers into frequency values.
3. Connect the output of mtof to the frequency inlet of phasor~.
Now each note from your keyboard triggers the waveform at a new frequency — like a custom oscillator.
Step 6 – Output and Testing
1. Connect the output of wave~ to plugout~ (for Max for Live) or dac~ (for standalone).
2. Turn on the audio.
3. Move the knobs on your MC-24 and watch the waveform~ object update in real time.
4. Play a few notes on the keyboard — you’ll hear your drawn waveform as a tone.
Conclusion
In this workshop, you learned how to:
- Receive and scale MIDI CC data in MaxMSP.
- Write control values into a buffer~.
- Visualize and play that buffer as an audio waveform.
- Combine MIDI control and synthesis for a tactile, visual approach to sound design.
You’ve just built your own waveform drawing instrument — a small but powerful tool for exploring the relationship between physical control and sound shape.
Troubleshooting / Notes
No Sound
- Make sure Audio is turned on in Max.
- Ensure wave~ is connected to plugout~ or dac~.
Waveform Not Updating
- Check if ctlin 1–24 is receiving data. Create a Message Box, connect it to the output of ctlin, and verify that MIDI messages are being received.
- Make sure each knob on your MC-24 is assigned to the correct MIDI CC number (1–24).
- Make sure scale 0 127 -1. 1. and pack i f are properly connected to prepend set before sending to the buffer.
Distorted or Static Sound
- The phasor~ frequency might be too high or too low. Verify that it receives a proper frequency from mtof.
- Check that your waveform values are within the range of –1 to 1.
All Knobs Affect the Same Point
- Ensure that ctlin 1 24 is set correctly — the first argument defines the lowest CC number, and the second defines highest.
- Verify that pack i f correctly sends each index (i) with its value (f).
- If needed, add a print object after pack to debug the CC numbers.
Waveform Display Not Visible
- The waveform~ object must reference the same buffer name as buffer~ (for example, both should be called waveform).
- Check that the buffer name in waveform~ waveform matches the argument in buffer~ waveform @samps 24.