(max) synth with pitch modulation

adding pitch modulation, part 1 (and selectable waveforms)

<WaveformSynthWorking1~.maxpat> (for poly~)

I’ve adjusted the SimpleSquareKK2~ patcher in a number ways. There are a lot of encapsulations now, to make the patcher clearer by having less clutter and subpatchers named after the function they perform. Encapsulations:

  1. note input and velocity handling
  2. envelope and amplitude scaling
  3. portamento control
  4. pitch conversion from MIDI to frequency
  5. oscillator waveform selection (new section)
  6. gain control

The selectable waveform option is the most significant addition. Multiple oscillators feed into a [selector~] object. A [umenu] controls what inlet is passed to the outlet. The waveform selection is made from the parent patcher.

adding pitch modulation, part 2


Having simplified the subpatcher, we can add pitch modulation controls, which include LFO, pitch bend, and pitch envelope control. As an overview:

  • express your pitch modulation in half steps, since frequency varies by register.
  • set up modulation to be +/- 1 half step, then multiply output by actual pitch modulation depth you want (including fractions of half steps)
  • add pitch modulation to MIDI note input at audio rate. MIDI note input is converted to an audio rate signal before adding pitch modulation
  • convert combined MIDI note input and pitch modulation at audio rate

All of this is well-commented in the example patchers. Make sure you examine each of the subpatchers.

pitchMod (inside of WaveformSynthWorking2~) contains a subpatcher for LFO modulation, pitch bend, and pitch envelope. Rate, depth, and bend amount are sent from the parent patcher. Pitch envelope duration and pitch envelope depth is also sent from parent patcher. The controls in the parent patcher are inside of the [p pitchModControls]. The pitch envelope also needs to be triggered with noteon events, so it gets noteon velocity from note input to trigger the envelope. I have not include sustain control in the pitch envelope, but you could modify it to make it work.

The pitch envelope subpatcher also has added x and y zoom controls via the rsliders (range sliders). You can zoom in on a small range by selecting a small amount in the rslider (corresponding to the area you want to zoom in). There is a reset button to quickly zoom out all the way.

The pitch modulation controls from the parent patcher could use physical control (MIDI CC). You can easily add that, and scale appropriately.

using [number~] instead of line~

In many of the subpatchers of <WaveformSynthWorking2~.maxpat> I’m using a [number~] object to convert a control rate message to an audio rate signal. If you set [number~] to “permit signal output mode” only, then you [number~] will convert the message an audio signal. Further down the inspector you can also set a ramp time in ms, which is like the time argument in a message pair to [line~].


Leave a Reply