Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I stand corrected. Enharmonic stuff has to be a nightmare.


That's putting it mildly, but I'm slowly getting more grip on it, fortunately a lot of people far smarter than me have spent a lot of time on this problem and bit by bit I'm implementing their thoughts into software.


A fun example is this bar from Liebenstraum no 3, https://imgur.com/a/ud1VlJF

It's the second bar on, the left hand goes A F# B# D# B# F# - Aflat F# C Eflat C F#

Only the first note has actually changed though.

Enharmonics in the same bar for the same pattern. I suppose there's some musicological explanation for this, maybe something along the lines of working towards a key change, but good luck intuiting this in software...


I have no illusion that this will ever be perfect, but there is something that may be 'good enough' for the general purpose and then maybe we can very incrementally improve from there. One way in which to solve this is to use an algorithm for the bulk and a database of exceptions for cases where the algorithm would get it wrong.


This is my first comment on HN. I wrote some algorithms to do with this topic. I've been working on some code for a long time which looks at the c=2^12 combinations of notes, their properties and so on. I call each of them changes. I'm actually still working on material for a book which contains dynamically generated layouts based on these changes. So far I have addressed many music set theory properties, as well as some visualisation on different instruments like piano, fretboard (arbitrary). One of the algorithms looks at finding the most efficient enharmonic spelling for a given change.. It may be helpful. If anything you could look at the Python for that function and derive something suitable.. Feel free to PM.. Let's say that keys = 12, and changes = 2^12.. so you'd have 48152 possible key changes.. for each of these there are basically three enharmonic roots.. The you could multiply that by the potential variation within the scale degrees. If you just brute force that you'd essentially just keep the one with fewest accidentals


Super interested in this, could you please contact me via jacques@modularcompany.com? (your profile is not filled out for me so I don't know your email address, note that HN has the option to add a public email address as well in your profile but for you that is still blank).


How would this method handle the bar I posted?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: