A useful subpatch for mixing and balancing two sounds

To mix two sounds together equally, you just add them together. If you know that both sounds will frequently be at or near full amplitude (peak amplitude at or near 1) then you probably want to multiply each sound by 0.5 after you add them together, to avoid clipping. However, if you want to mix two sounds unequally, with one sound having a higher gain than the other, a good way to accomplish that is to give one sound a gain between 0 and 1 and give the other sound a gain that's equal to 1 minus that amount.

A demonstration of phase distortion synthesis

Phase distortion is a synthesis technique that was used in some Casio synthesizers in the 1980s. In traditional wavetable synthesis, a linear upward ramp signal is used as a phase index to read cyclically through a wavetable containing a particular waveform (a sine wave being the most common). In MSP you can do that by connecting the output of a phasor~ object, which generates a cyclic upward ramp from 0 to 1, to the right (phase offset) inlet of a 0 Hz cycle~ object (containing one cycle of a cosine waveform by default).

Phase distortion synthesis in a poly~ subpatch

This shows an implementation of phase distortion synthesis in MSP—using the phasor~, kink~, and cycle~ objects—in a patch that is designed to be used inside the poly~ object. For an explanation of this sort of phase distortion synthesis, see “A demonstration of phase distortion synthesis.” The main point of this example, though, is to show how a synthesis patch can be designed to respond directly to MIDI input.

Constant power panning using table lookup

In "Constant power panning using square root of intensity" we used the square root of the desired intensity for each speaker to calculate the amplitude of each speaker. However, square root calculations are somewhat computationally intensive, and it would be nice if we could somehow avoid having to perform two such calculations for every single audio sample. As it happens, the sum of the squares of sine and cosine functions also equals 1.