springs affect in turn the net energy of the system.
By minimizing the total energy of the system, the
dissonance is presumed to be also minimized.
Three kinds of springs are used: vertical for simul-
taneous notes, horizontal to represent changes in pitch
of a note while sounding (or successively played), and
grounding springs to penalize the tuning drift of the
whole piece.
deLaubenfels’ program calculates the minimum
energy state of a sequence’s spring-network using
successive approximations produced by Monte Carlo
pseudo-random motion through the tuning space.
This algorithm re-tunes every note in the sequence un-
til zero net spring force is achieved for every interval.
3.1.2 Psycho-acoustical Curves
Sethares (Sethares, 2002b) uses the tonotopic theory
in Adaptun, a program to render more consonant
MIDI sequences in real-time. His algorithm grad-
ually decreases the precalculated dissonance of any
given chord by iteratively making small adjustments
in the pitch. The instrument spectrum for each MIDI
channel is known a priori; the calculation ignores the
amplitudes of the harmonics; a nominal frequency is
used to estimate the bandwidth for all the partials; and
the dissonance gradient is obtained by a variation of
Simultaneous Perturbation Stochastic Approximation
(SPSA).
SPSA is similar to simulated annealing in the way
that perturbation size is damped with every iteration,
but simulated annealing seeks global minima, while
SPSA seeks local minima (Spall, 1999). It uses only
two loss function evaluations per iteration, is tolerant
to noisy signals, and needs no information about the
gradient. The difference between the original SPSA
and the variation proposed by Sethares is that in the
latter, the damping coefficients don’t vanish, allowing
his model to incorporate newly arriving notes.
In Adaptun, tonal drifting is prevented by means
of context, persistence, and memory models. These
mechanisms include absent partials in the dissonance
calculation which are somehow remembered by the
listener. Several musical examples processed with
Adaptun can be downloaded from (Sethares, 2002a).
3.1.3 MIDI Issues
The MIDI protocol specifies three mechanisms to al-
ter the tuning of a single note: Bulk Tuning Dump
(non-realtime), Bulk Tuning Dump Request (non-
realtime), and Single-note Tuning Change (realtime.)
Although this last mechanism is the most suitable for
realtime implementations, it’s rarely found in contem-
porary synthesizers. To circumvent this problem, a
combination of pitch, pitch bend change, and pitch
bend sensitivity is commonly used to achieve the de-
sired frequency of a note. This mechanism is detailed
in (Villegas and Cohen, 2005).
There are several limitations to consider when us-
ing this combination: the pitch bend messages are ap-
plied to a MIDI channel, so the pitch bend value af-
fects all notes in a single channel, making it impossi-
ble to play a chord correctly. Also, if the release time
is long enough, the effect of a new pitch bend message
can be heard on the previous notes.
3.1.4 Observations Regarding Adaptun
Sethares’ program references the dissonance of each
timbre using a frequency of 500Hz. Instead of be-
ing calculated each time, these values are read from
memory easing the realtime implementation.
The use of a nominal frequency implies a uni-
form critical bandwidth across the auditory spectrum.
However, this is not the case. In Adaptun, the band
size error increases as the frequency increases or
decreases. Although Sethares’ implementation and
Helmholtz’s theory assume that the critical bandwidth
is independent of frequency, Plomp and Levelt have
emphasized the salience of the frequency in this cal-
culation.
4 PROPOSED MODEL
The purpose of the function to calculate tonal disso-
nance is to mimic the results obtained by Plomp and
Levelt. Even the value where the dissonance reaches
a maximum is described by them as “a rule of thumb”
(Plomp and Levelt, 1965).
Sethares formulated his model by a least-squares
fit from Plomp and Levelt experimental data. Benson
(Benson, 2005) proposed an alternative expression
d(x) = 4|x|e
1−4|x|
, (2)
where x is the frequency difference as a fraction of
the critical bandwidth. This expression was adapted
to include ERBs, so for a dyad with amplitudes a
1
and
a
2
at frequencies f
1
and f
2
, dissonance is calculated
as
d(a
1
, a
2
, f
1
, f
2
) = 2.5a
1
a
2
∆f
bw
e
1−2.5
∆f
bw
, (3)
where ∆f = | f
2
− f
1
| and bw = ERB(max( f
2
, f
1
)).
According to Plomp and Levelt, the dissonance
reaches a minimum value when the frequency differ-
ence is about one critical band. Beyond this interval,
LOCAL DISSONANCE MINIMIZATION IN REALTIME
95