Understanding Streams, Patterns and Events - Part 5:
Filter:

Understanding Streams, Patterns and Events - Part 5

Event.default

More about the default Event:

protoEvents

The protoEvent contains default values for many useful parameters.

The default protoEvent is Event.default. It provides default bindings for duration, envelope, instrument, making a very simple Pattern directly playable:

By adding other bindings, you can override the defaults in the protoEvent.

~finish

Event.default contains a function bound to the Symbol 'finish' which is called for each new event generated in order to complete any computations that depend on the other values in the event.

The pitch model

Event.default implements a multi level pitch model which allows composition using modal scale degrees, equal division note values, midi note values, or frequencies in Hertz. These different ways of specifying the pitch can all be used interchangeably.

The way this works is due to the default values bound to the Symbols of the pitch model.

The lowest level Symbol in the pitch model is 'freq'. The default binding for 'freq' is a Function which calculates the frequency by getting the value of 'midinote', adding a transpose value and converting it to Hertz using midicps.

If you compose with 'freq' directly then this default function is overridden.

Event.default's 'finish' function sends the value message to the current binding of 'freq' in order to get the value for the frequency and adds a detune value to it which transposes the frequency in Hertz.

The next level is 'midinote' which is by default bound to this function:

This function gets the value bound to 'note' which is a value expressed in some equal temperament, not necessarily 12. It adds a gamut transpose value 'gtranspose', and scales from the number of notes per octave being used into 12 notes per octave MIDI key values. If you compose with 'midinote' directly then that will override this function.

Another level higher is 'note' which is defined by default by this function:

This function derives the note value from the next higher level variables which specify a pitch from a scale. These variables are defined as follows:

The number of equal divisions of an octave for this tuning. The equal temperament defined by this variable is known as the gamut. If you wanted to work in cents for example you could set this to 1200.0.

The current octave. Middle C is the lowest note in octave 5.

The root of the scale given in equal divisions defined by ~stepsPerOctave.

A set of scale pitches given in equal divisions defined by ~stepsPerOctave.

A scale degree index into the ~scale. 0 is the root and the scale wraps in the manner defined by degreeToKey.

A modal transposition value that is added to the scale degree.

A gamut transposition value that is added to the gamut pitch.

A chromatic transposition value expressed in semitones.

Pitch model Examples

The duration model

Duration is expressed in beats and is bound to the 'dur' symbol. The sustain time of a note can be expressed directly in beats or by using a legato value which is multiplied by the note duration to get the sustain time.

To go to the next file: Understanding Streams, Patterns and Events - Part 6