(max) basic audio – oscillator and amplitude control

I’ve created three patchers that demonstrate basic audio generation in Max, both involving an oscillator with frequency input and output amplitude control.

I’m only including brief summaries here. Example patches are well-commented, and all new objects are labeled with a comment name and short explanation. Remember, with any object highlighted, you can choose the reference icon in the right border to see documentation for the object, or you can option-click on any object for a working help patcher.

basic audio 1

<basicAudi01.maxpat> in Example Patchers Folder

A simple patcher with a sawtooth oscillator (saw~), leading to amplitude control (*~), leading to audio output (ezdac~) and various monitoring meters (meter~, levelmeter~, and number~).

The saw~ has a floating-point object connected to change its frequency. Remember that numbers used in digital audio are typically floating-point numbers (numbers with a component after the decimal). The multiply object (*~) has a float input to control amplitude.

This patcher demonstrates how sending control-rate messages to audio-rate objects will cause audible clicks because of instantaneous changes to the audio signal.

basic audio 2

<basicAudio2.maxpat>

BasicAudio2 introduces the line~ object, which takes a control rate messages and outputs audio rate signals in a smooth ramp. You send line~ a list consisting of <target value> and <time to get to target>. Take a look at other changes, and other ways you can send messages to line~. Using line~ as an input to both frequency and amplitude is necessary to make changes to audio signals without clicks.

basic audio 3 – mouse theremin

<basicAudio3.maxpat)

BasicAudio3 takes the basic part of the previous patcher, changes the sawtooth oscillator to a square wave oscillator (rect~) and adds mouse control of frequency and amplitude.

mousestate reports the x and y location of your mouse when it receives a bang. To get constant reporting of your mouse location you need to send a metro running at a fast speed (50 ms in this example) to mousestate. Since the toggle controls the metro, turning on the toggle turns on mouse location reporting.


Comments

Leave a Reply