Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^5: utf8 hash keys revisited: How can i use musical symbols as hash keys?

by Jim (Curate)
on Oct 07, 2014 at 22:47 UTC ( #1103120=note: print w/replies, xml ) Need Help??


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𝄫).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1103120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2021-01-27 21:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?