Subject: Re: MIDI renovations available for testing
To: Chapman Flack <>
From: Gavan Fantom <>
List: tech-kern
Date: 05/24/2006 12:07:10
Chapman Flack wrote:

> In which case you might establish that it falls back to LRU (perhaps)
> if there is no other information to use, but we've already established
> that the keyboards will make use of other information when available
> to improve on strict LRU.  In a typical MIDI stream there will be
> velocity differences to look at, and some channels will have different
> volume controller values, and some may have the legato
> or portamento controllers active (probably should be a penalty for
> stealing from these) and so on. I suspect midisyn would sound better
> if it looked at some of that information too.

I wonder if selecting the quietest note first, and then LRU only for
arbitration, might sound a little strange.

A reasonable approach here I think would be to produce a score based on
a number of factors. Let's say, velocity (possibly weighted by program
number), channel volume, "newness" (some inverse of time since trigger),
and perhaps some bonus for legato or portamento controllers. Some
classification of sounds into legato vs staccato (eg synth pad vs
orchestra hit) would be useful here.

Then steal the voice with the lowest score.

If you want to get really clever, you could consider harmonic content.

Firstly, I want to be clear that you need to be careful about sorting
tuned voices from untuned voices (such as drums) or voices tuned to
non-chromatic scales (on many synths, telephone ring, helicopter,
gunshot and sometimes some drum sounds are tuned such that each pitch
value actually represents a fraction of a semitone)

The extreme examples:

If you have a pair of notes an octave apart, you can eliminate one of
them without substantially altering the harmonic content, especially if
they are playing the same patch.

If you have a pair of notes a semitone or a tone apart, eliminating one
of the pair will remove a dischord, which is likely to be musically

(or a wrong note, in which case, tough!)

More generally, if you can at least try not to allow a short-lived note
to steal from a long note, or at least not too often [until a change in
harmony occurs, an established harmony remains in the mind of the
listener for a little while even after the notes are no longer being
played] then you can simply thin out the harmony. I suppose the risk you
run there is that a future change in harmony may rely on a dischord
between a new note and a note which you have previously eliminated. But
even then, while you lose the dischord, the new note will still
introduce the new harmony.

Being able to identify a chord will be useful here. If you can identify
the tonic, this is likely to be a note worth leaving in. As is usually
the bass note. If one note in the chord is heavier than the others, it
may be wise to choose to leave that one in instead.

Let's say you have a chord consisting of G C E G Bb C E

The tonic is C, but the chord is in 2nd inversion due to the low G.

There are three duplicated notes to choose from for the first
elimination. The lowest note isn't a good choice to eliminate, as it
could well form part of a bassline, and determines the inversion. The
tonic would generally also not be a good choice, but the C in the octave
above remains a candidate. You could comfortably remove one of the Es
(but not both). I'm not sure whether favouring open or closed chords
would be preferable here. If we say closed, we'd remove the upper E.

Once you've removed three notes, you're left with G C E   Bb

This is about as basic as a C7 chord can get. After this, you lose bits
of the chord.

Take out the third next. The third determines whether it's a major or a
minor chord, but that will persist in the mind of the listener.

G C     Bb

There's not much left at this point. You could keep the seventh (Bb)
hanging on until the bitter end in the hope that before we steal all the
notes we will reach a resolution and remove the fifth (G), or you could
lose the seventh and leave at least a very basic power chord.

Whichever you choose, the next to go is the other of those, leaving the
tonic (C).

To illustrate this, I have assumed that all of the notes being stolen
are being used for atonal sounds, such that they do not contribute to
this calculation.

Of course, this is quite hairy stuff to turn into an algorithm, but it
should at least give you some ideas, and could lead to some heuristics.

Gillette - the best a man can forget