RE: FYI: GM Drums Patch Hash

[email protected] ("Sean M. Burke") Tue, 22 May 2001 16:00:51 -0600
Newsgroups perl.midi
Message-ID <[email protected]>
At 10:22 PM 2001-05-22 +0100, Lee Goddard wrote:
>The spellings in both our versions are a bit anomalous, though:
>"Mute Hi Conga","High Agogo", "Hi-Hat" ... is this intentional
>on your part?   (I'm using a corrected version, as I can't 
>remember when to use which error.)

No, not really intentional.  I got all that data from something at least
semi-official-looking (whatever that means for MIDI specifications!).  I
/think/ I considered "cleaning up" those spellings, but decided against it,
since what do I know about preferred spellings for hi(gh)(-)hats?
I do remember thinking that, notably for hi(gh) hats and quica/cuica,
spelling variation was going to be a problem -- at least if you're going
from strings to numbers.  Then there's the capitalization problem too.

I suppose I could start adding aliases, as in:

$MIDI::percussion2notenum{'variant_spelling1'} = 123;
$MIDI::percussion2notenum{'variant_spelling2'} = 123;
$MIDI::percussion2notenum{'variant_spelling3'} = 123;
...

but I think I'd never run out of variant spellings.  I think a better way
is either 1) always just use the "canonical" name (and we might as well
assume that the contents of 
%MIDI::percussion2notenum is canonical), or 2) someone can write a fuzzy
matching routine that gets the percussion note number, given an effect
name, but forgiving all sorts of variation.  Presumably the same algorithm
could be used for getting the patch number, given the instrument.

On the one hand, fuzzy matching is nice.  On the other hand, it's hard to
imagine what fuzzy_patchnum('piano') should do, as there's a half-dozen
kinds of piano patches, four of which ("Acoustic Grand", "Bright Acoustic",
"Electric Grand", "Honky-Tonk") don't even have the string 'piano' in their
"canonical" patch name.


Because of just these problems, I sort of hope that people can just manage
to use the patch numbers either directly, or by deciding that the six
instruments they're using in a given piece will be denoted by my $high_hat
= 43, or maybe "n43", and so on for the other instrument numbers; and then
using that variable name whenever you want to switch to that instrument.
That way, if you're running under 'use strict "vars"' (always a good idea),
then you know that you'll only have one allowable way to spell $high_hat.
If you declare it $high_hat but spell it $hi_hat later on, Perl will scream
and shout, when compiling the program.


--
Sean M. Burke  [email protected]  http://www.spinn.net/~sburke/