Previous solutions
4.3 M IDI -based solutions
MIDIis a hardware and software specification intended to enable communicate among multiple musical instruments [26]. The conjunction of MIDI and electronic synthe-sizers offers a new way possibility to override the physical constraints that limit the tuning adaptability of a broad set of instruments. This has been exploited by many re-searchers, the most illustrative being deLaubenfels [27] and Sethares [28], respectively considered in the following subsections.
4.3.1 Springs network
...
B C
· · · ·
A
Ground
k2
k1
k0
Figure 4.2: The ellipses indicate the possible presence of moreMIDI notes in the se-quence. The ‘ground’ node is the original tuning of the sese-quence.
John A. deLaubenfels [27] proposed a method for obtaining less dissonant MIDI
sequences using Just-tuning intonation. He expresses the relationships between the notes in a ‘spring network’ model, the accumulated energy of interconnected virtual springs being the ‘pain’ or the dissonance measurement of the sounding notes. Three kinds of springs are mainly used: vertical springs to represent the relationship between simultaneous notes, horizontal springs to represent the changes in pitch of a note while it’s sounding (or successively played), and grounding springs to measure the tuning drift of the whole piece respecting its key or the original frequencies at which the notes were played at the beginning. Figure 4.2 presents an example of a spring network as proposed by deLaubenfels. When a fixed-tuning mode is selected, only the vertical springs are considered.
In analogy with a physical system, elongation changes in any of the interconnected springs affect the net energy of the system, so by minimizing the overall energy of the system, the dissonance at any given moment in the sequence is minimized.
To obtain a dissonance-minimizedMIDIsequence using deLaubenfels’ method, the sequence is loaded into a program that connect the necessary springs, and specify the elasticity of each spring depending on the loudness of the notes at a given time and general user-preferences. The minimum energy state of the resulting spring-network is then calculated and minimized using successive approximations in conjunction with
Monte Carlo pseudo-random motion through the tuning space. Although deLaubenfels recognizes that there are deterministic ways to find it (i.e., by calculating the inverse of the connections matrix), the chosen mechanism was found more suitable for long sequences and models using non-linear springs. The algorithm re-tunes every note in the sequence until zero total spring force is achieved for every spring. Examples of his results, and extended explanations, can be obtained from [27].
The force fn and potential energy En for an isolated spring n in deLaubenfels’
system are presented in Equations 4.1 and 4.2, wherek is the elasticity constant of the spring, andx its elongation:
Sethares [28] uses the tonal consonance curves of Plomp and Levelt in ‘Adaptun,’ a program developed in Max to deploy more consonantMIDIsequences in real-time.
Sethares claims that sensory dissonance (or the cost function) is a generalization of Equation 2.7 concretely, the sensory dissonance D of m concurrent sounds with different timbres (considering the firstn partials only) is the sum of dissonances of all the intervals at a given time, and can be calculated by means of Equation 4.3:
D = 1 The algorithm proposed by Sethares in Adaptun is to calculate the sensory disso-nance of m concurrent sounds using Equation 4.3, and by small adjustments in their fundamental frequenciesfm every k iteration, to decrease the dissonance value until differences between successive frequencies fall below a thresholdδ for all the pitches:
do
whereµ is an arbitrarily small constant. The minus sign in the gradient guarantees that the approximation converges to a minimum point of inflexion, not a maximum.
Nevertheless, in Adaptun several simplifications are made in consideration of practical time constraints:
1. The instrument spectrum for each MIDI channel is known a priori by the soft-ware.
2. Equation 2.4 is implemented as a look-up table, anda1anda2are set to unity.
3. A nominal frequency of 500 Hz is used for all calculations between all partials.
4. The calculation of the gradient is avoided in the algorithm, and instead is ap-proximated by
fi(k + 1) = fi(k) − µg(fi(k)) where
g(fi(k)) = D(fi(k) + c∆(k)) − D(fi(k) − c∆(k)) 2c∆(k)
and ∆(k) is a randomly chosen ±1 vector with a Bernoulli distribution (the probabilityp = 0.5).
The substitution g(fi(k)) is a variation of the Simultaneous Perturbation Stochastic Approximation (SPSA) method [29] [30] explained in detail later. µ and c are selected so the updates offiaverage about 1 ¢. The difference with the originalSPSAis that the coefficients (µ and c) don’t vanish, allowing therefore recognition of newly arriving notes. The user can override these default parameters through a graphical interface [28].
Finally, tonal drifting is prevented in Adaptun by means of context, persistence, and memory models. These mechanisms include absent partials in the dissonance calculation, which presence is important because they are somehow remembered by the listener. Several musical examples processed with Adaptun can be downloaded from [31].
4.3.3 M
IDIissues
Although the MIDI protocol [26] provides mechanisms for tuning individual notes in real-time, there’s no consensus among electronic instrument manufacturers about their implementation. In general, the applications mentioned earlier differentiate in their approach and methodology to calculate (or approximate) the best tuning for a note at a given time, but converge in the way they send each calculated note to a synthesizer:
the calculated note is expressed as twoMIDImessages, the first one adjusting the pitch bend of the channel to achieve the desired frequency from the closest 12-TET pitch of the scale, and the second firing a NOTE-ON message of that pitch, after which the synthesizer proceeds to produce the sound.
The PITCH BEND ADJUSTMENTmessage is a 14-bit message (for a total range of [0,16384)), no pitch bend change being indicated by a message with value 8192. Its final value is determined in the receiver in consideration of the PITCH SENSITIVITY
parameter. Having previously adjusted it to one semitone (via anRPN message), and considering that the maximum bending possible is the 8192, the maximum resolution possible is about 0.01 ¢(a centicent!).3 This resolution is more than sufficient for any acoustical application, since one ¢ is less than half the just noticeable difference for human listeners [18]; however, the quality of this mechanism is uneven across different manufacturers.
3 100
8192= 0.0122 ¢ /MIDIrange.
The MIDI protocol specifies three mechanisms to alter the tuning of a single note using Universal System Exclusive Messages: Bulk Tuning Dump (non-realtime), Bulk Tuning Dump Request (non-realtime), and Single-note Tuning Change (realtime). Al-though the last mechanism is the most suitable for real-time implementations, it’s rare to find it in contemporary synthesizers. To overcome this limitation, a combination of pitch, pitch bend change, and pitch bend sensitivity messages is used, as mentioned before. The mechanism of combining different messages presents the following limi-tations: the pitch bend messages are specific for eachMIDI channel, and all the notes played in a given channel are affected by its current value, making it impossible to play a chord correctly in a single channel. This problem can be avoided by playing each note of a chord on a different channel, consequently restricting the polyphony to 16 parts (in absence ofMIDI channel extension). Another known limitation is that it’s possible to hear the effect of the next pitch bend message over the end of the previous note if the release time is long enough (the release time follows aNOTE-OFFmessage).