in reply to Re^4: utf8 hash keys revisited: How can i use musical symbols as hash keys?
in thread utf8 hash keys revisited: How can i use musical symbols as hash keys?
If maintaining a one-to-one relationship of %helmholtz_to_midi keys to %midi_to_helmholtz keys is an important requirement, then, yes, you have to do something kludgy like use a compound identifier. For example:
$helmholtz_to_midi{'a♯¹/b♭¹'}{midi_note_number} = 70;
and
$midi_to_helmholtz{'70'}{helmholtz_note_name} = 'a♯¹/b♭¹';
But the inescapable musical fact remains: there isn't a one-to-one relationship of MIDI note numbers to Helmholtz note names. There's a one-to-many relationship, just as there's a one-to-many relationship of pitches (440 Hz) to enharmonic notes (g𝄪¹, a¹, b𝄫¹).
|
---|
In Section
Seekers of Perl Wisdom