2014 - Week 32
There are endless ways how we can map x-dimension to pitch. This patch-a-week is focused on 12 tone equal temperament, the predominant scale in modern western music. We will elaborate a bit on how to map a continuous x-dimension (e.g. from the Chimaera) to pitch and frequency.
Fractional MIDI notes
Most musicians will be familiar with MIDI notes, let us therefore base our mapping on top of the latter. But as we are facing a continuous scale, and MIDI notes are integer, we will use the concept of fractional MIDI. As two MIDI notes are evenly spaced by 100 cents), we can easily derive a definition of a fractional MIDI value representing a continuous scale:
Linear mapping of x-dimension
With number of sensors , octave and base note , we can derive a linear mapping from x-dimension to fractional MIDI notes . The formula for the base note may look a bit weird at first glance, but it has its reason, as the formula is adapted to the default engravings on the Chimaera controller. Depending on the case size, the engravings will slightly differ, e.g. the cyclic pattern will start at different offsets. This is needed in order to arrange a many complete pattern as possible on any case size. The formula will take the variable offset into account. The following equations will map the span of three sensors to one MIDI note, e.g. a note, whereby the middle sensor will coincide with the integer note.
We start off by shifting the base MIDI note to the right octave’s C note, then subtract a note (which corresponds to 1.5 sensors) and finally subtract by a variable offset. The offset is straightforward to derive. The x-axis with its sensors is divided in as many complete half-octaves (6 MIDI notes, each 3 sensors wide) and the remaining sensors are distributed equally to the bottom and the top of the scale, e.g. divided by 2 and the converted to fractional MIDI notes, e.g. divided by 3.
The final fraction MIDI note will then be a simple linear relationship of dimension , offset by base note .
Linear mapping from x-dimension to fractional MIDI for n=48 sensors and oct=2.
Stepwise mapping of x-dimension
Sometimes it will be handy to have integer MIDI notes only, without a continuous mapping. This can easily be achieved by rounding the continuous mapping to a stepwise mapping which increases by integer values.
Stepwise mapping from x-dimension to fractional MIDI for n=48 and oct=2.
Polynomial mapping of x-dimension
And sometimes it may be advantageous to have something in between a linear and a stepwise mapping, e.g. a relationship where the main mapping is a stepwise, but between the steps, there will be a continuous relationship. When plotted, this looks like a curve with wide plateaus at each integer step. The higher the polynomial order , the wider the plateau.
Such a polynomial mapping is calculated by first deriving the fractional difference between linear and stepwise mapping. The fractional difference (which ranges over ) is then put into its corresponding order and rescaled to the original range and added to the stepwise mapping.
For an order we get the initial linear mapping. Note that there are two slightly differing formulae for even and odd polynomial orders.
Polynomial mapping from x-dimension to fractional MIDI for k=2, n=48 and oct=2.
Polynomial mapping from x-dimension to fractional MIDI for k=3, n=48 and oct=2.
Polynomial mapping from x-dimension to fractional MIDI for k=5, n=48 and oct=2.
Polynomial mapping from x-dimension to fractional MIDI for k=9, n=48 and oct=2.
A ready to use SuperCollider class incorporating all three types of x-dimension mapping (linear, stepwise, polynomial) can be get at our SuperCollider repository.