kslider

Overly simple MIDI synth

This is a bare-bones monophonic MIDI synthesizer that uses the pitch and velocity information from incoming MIDI note messages to control the frequency and amplitude of a sawtooth waveform. 

This patch uses the MIDI key number (pitch) data byte to set the frequency of a sawtooth oscillator, and it uses the velocity data byte to set the amplitude of the oscillator. Note-on velocity values in the range 1-127 are mapped to a range of decibels from -60 to 0, and those decibel values are then converted to linear amplitude values to scale the amplitude of the oscillator.

Using a sustain point in a function object

When you play a note with MIDI, you usually want the note to sustain as long as the key is held down, then you want it to turn off (either immediately or gradually) when the key is released (when the note-off message is received). Because MIDI is designed to function in real time, in live performance, there is no duration information contained in a note-on message. The duration can only be known once the key has been released.

Harmonizer written in JavaScript

As a demo project to explore JavaScript programming in Max, this patch implements a script that harmonizes any played MIDI note with either a major seventh chord or a minor seventh chord that contains the played note. For any given pitch, there are four different major seventh chords and four different minor seventh chords that contain that pitch.

ADSR filter envelope

An ADSR envelope generator is a common tool for controlling the amplitude of a note, and in fact it can be used to control any parameter of a sound. In this example, one adsr~ object controls the amplitude of a note while another adsr~ controls the cutoff frequency of a lowpass filter on the sound. Both are triggered at the same moment, but they have slightly different parameters for independent envelope shapes.

Simple wavetable synthesis

One of the earliest methods of digital sound synthesis was a digital version of the electronic oscillator, which was the most common sound generator in analog synthesizers. The method used was simply to read repeatedly, at the established sample rate, through a stored array of samples that represent one cycle of the desired sound wave. By changing the step size with which one increments through the stored wavetable, one can alter the number of cycles one completes per second, which will determine the perceived fundamental frequency of the resulting tone.