3 ms·
This is an excellent point- as mentioned below, MIDI files do not take into account stuff like key, time signature, etc. , all of which are quite important to u
by necrotic_comp 6y ago
This is an excellent point- as mentioned below, MIDI files do not take into account stuff like key, time signature, etc. , all of which are quite important to understanding a piece ; Western music notation is both incredibly dense and concise, with no information wasted.
Part of the art of practicing is the mental work of abstraction and internalization of the music - breaking it into smaller sections, understanding the key changes, seeing the broader rhythmic structure, etc. - if you don't have this and (more importantly) don't have a teacher to help guide you through this process, you're definitely going to hit a brick wall once things start to get woolly.
- jacquesm 6y ago> MIDI files do not take into account stuff like key, time signature, etc. They actually do. What they don't take into account is whether a particular black key is a sharp or a flat, and this causes all kinds of headaches. https://en.wikipedia.org/wiki/Enharmonic https://en.wikipedia.org/wiki/Enharmonic
- necrotic_comp 6y agoI stand corrected. Enharmonic stuff has to be a nightmare.
- jacquesm 6y agoThat'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.
- murbard2 6y agoA fun example is this bar from Liebenstraum no 3, https://imgur.com/a/ud1VlJF 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...
- jacquesm 6y agoI 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.
- keymasta 6y agoThis 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
- jacquesm 6y agoSuper 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).
- murbard2 6y agoHow would this method handle the bar I posted?
- PaulDavisThe1st 6y agoThey do not take "key" into account. In terms of the note-related data contained within a MIDI file, it's just a series of noteOn and noteOff event pairs, with a note number between 0 and 127 for each event. There's nothing in a MIDI file that specifies the key/scale/mode. They can describe time signatures and tempo. And yes, they don't handle enharmonics because in MIDI, notes are known only by number, not by any name given to them by any part of any given musical culture or theory. And because of the MIDI Tuning Standard, you cannot actually say a priori which notes (i.e frequency) a given note number corresponds to, although in practice most things will take the note number and map it to a a 12TET 440Hz standard.
- jacquesm 6y agoYes, but MIDI does allow for the file to contain a KEY specification (as well as tempo, time signature and a bunch of other info). I know the scale/key/mode as such as not encoded in the note on/off signals but once you know what key you are in (and this can be determined in a variety of ways, including from the statistical properties of the note on/note off signals) the problem becomes a bit more tractable. Still, you will never get it perfect and that is not the goal, the goal is to get it as good as possible (and we are not even there yet). > And because of the MIDI Tuning Standard, you cannot actually say a priori which notes (i.e frequency) a given note number corresponds to, although in practice most things will take the note number and map it to a a 12TET 440Hz standard. This is true, but for a teaching application like this one it is simply not relevant.
- PaulDavisThe1st 6y agoThe key signature meta-event is barely functional if you have a remotely expansive view of "music theory". Identifying a root note, major/minor and number of sharps OR flats doesn't really pin down a large number of actual scales. For your purposes, it may be enough, but in more general terms, it's woefully underspecified. A better way for MIDI to have done this would have been to use a "standard" scale numbering system combined with a tonicity count. An example or two is given here: https://ianring.com/musictheory/scales/ https://ianring.com/musictheory/scales/ I appreciate that your current project doesn't need this, but if someone wanted to somehow create a MIDI file that included the information "this uses Locrian with a flat second", the current SMF spec is inadequate.