8 ms·
Show HN: AutoMIDIFlip – An automatic MIDI flipper
- Sophira 10y agoI wrote AutoMIDIFlip based on the #midiflip challenge going around Twitter right now - basically, take a MIDI file, flip it so that the intervals are preserved but in the opposite direction, and see what it sounds like. It actually has some surprisingly good results. Andrew Huang did the first one manually, as can be seen in the YouTube video linked on the front page. I figured I could write code to automatically do it even for people who didn't have the software to do it themselves. I plan to add more features to AutoMIDIFlip - in particular, it'd be nice to have an optional feature to auto-shift the different channels up or down octaves in order to have them occupy the same sort of range as they did in the original MIDI, as that'd probably end up with more listenable tunes. (Bass notes become screechy notes of death right now.) So far, AutoMIDIFlip is the only automatic MIDI flipper I know of that preserves everything about the original song except for the note positions. In other words, if you flipped a tune twice, then removed the 6 extra empty MIDI tracks that AutoMIDIFlip would have added (3 per run, basically just attributing AutoMIDIFlip so that nobody just runs a MIDI file through it and calls it an original), you'd end up with exactly the same file, hash checksums and everything. There are only three exceptions to this rule: * If the original source didn't utilise MIDI's "running status" feature (which simply acts to reduce the file size by removing redundant information - more info at http://www.midikits.net/midi_analyser/running_status.htm http://www.midikits.net/midi_analyser/running_status.htm), then the resulting file from AutoMIDIFlip will be smaller than the original. It'll still contain exactly the same information, however. * For Format 0 MIDI files, AutoMIDIFlip will output a Format 1 MIDI file so that it can insert the empty attribution tracks. These tracks do not contain anything, and AutoMIDIFlip won't attempt to separate the file into tracks; you'll still just have one track containing all the data. * If for some reason the input MIDI file has more tracks than are indicated in the file header, those extra tracks will not appear in the output file. This scenario should basically never occur; if it does, there's something wrong with whatever program generated the MIDI file. I'm happy to answer any questions people might have!
- eridius 10y agoThe Flipped version of the William Tell Overture is missing most of the tracks. When I open the Original in Garage Band (macOS), it has 8 tracks (including an empty piano track). But the flipped version only has 1 track (trumpets). It looks to me like AutoMIDIFlip actually combined all of the tracks together (which of course means the instrumentation is now wrong).
- Sophira 10y agoThanks for the report! Things should be fixed now. :) Technically, it's probably GarageBand that's wrong here, but I've changed AutoMIDIFlip so that GarageBand should be happy. What was happening is that the original file is a Format 0 MIDI file. Internally, a Format 0 file only ever has one track, so all the instruments have to go into one track. That's okay because in MIDI, the channel numbers are stored per-note, so it still manages to work out. Each channel can only play one instrument at a time, though you can play multiple notes at once. It seems that when GarageBand opens a Format 0 file, it automatically splits out that one track into (I'm guessing) 16 tracks, one for each channel. It also sounds like GarageBand makes no distinction between tracks and channels, so you can only have one instrument per track. Prior to the change I just made, AutoMIDIFlip would always set the format field in the header to 1, so that it would output a Format 1 file; this was necessary so that it could add the three empty attribution tracks to the file. Everything else should have worked as before, but when GarageBand opens a Format 1 file, it will keep the layout of the tracks as specified in the MIDI file rather than splitting them into channels. Because of this, and because GarageBand doesn't have the distinction between tracks and channels, GarageBand was losing the instrumentation data that was in the original MIDI file. I've changed AutoMIDIFlip now so that it doesn't set the format field differently; if you give it a Format 0 file, you'll get a Format 0 file back. Because you can't add more tracks in that kind of file, it will append a short attribution - "(auto-flipped with automidiflip.com)" - to the title of the song instead. Again, thanks for the report!
- bambax 10y agoExcellent explanation!! Thank you! Do you know why it's possible to have different channels on the same track in MIDI? It's kind of cool to save channel information per-note, but do people really use this to have multiple instruments on one track? Like GarageBand, it seems most DAW associate a channel with a track and not individual notes. What was the use case originally?
- azeirah 10y agoI wonder what a song will sound like if its overlay + its original are layered on top of each other.
- Sophira 10y agoIt probably wouldn't sound terribly great; the site doesn't make any attempt to make sure that the flipped version is in the same key as the original (and in fact that would be extremely difficult, if not impossible), so you'd get a rather dissonant-sounding MIDI. I was curious though, so I tried it out on the Für Elise example. Here's the unedited version: http://automidiflip.com/merge-experiment/furelise-merged.mid http://automidiflip.com/merge-experiment/furelise-merged.mid As expected, it's rather horrible. I tried editing it so that they began on the same note but an octave down (as with Andrew's original video), but it wasn't much better: http://automidiflip.com/merge-experiment/furelise-merged-shifted.mid http://automidiflip.com/merge-experiment/furelise-merged-shi....
- leeseibert 10y agoI flipped the arpeggio from Stranger Things. Doesn't have the same umpf. Cool tool though.
- bcook 10y agoAre MIDIs still being used by any popular services, apps, OSs, etc?
- flatcakes 10y agoWell, MIDI data itself is still in heavy use in music production, both to interconnect hardware, and within software itself. It's the standard way to represent notes, timing, events, etc. within music-making software (DAWs). Actual MIDI files themselves? Mostly just used as a file format to share musical/rhythmic motifs or export between music apps, not as an end product in itself.
- janwillemb 10y agoMidi's are also used in streetorgans. (Which sounds way too 'computerized' in my opinion. Example[1]) [1] https://youtu.be/U9dxscRz5ek https://youtu.be/U9dxscRz5ek
- mkesper 10y agoI prefer this one (no MIDI in action to see, though): https://www.youtube.com/watch?v=fnb7EqfykF4 https://www.youtube.com/watch?v=fnb7EqfykF4
- janwillemb 10y agoHa! Nice! (After all the system used is a precursor of midi.)
- SeanLuke 10y agoWhat are "MIDIs"? MIDI is a singular mass noun, like USB or Firewire. The MIDI protocol is still dominant in the professional field for which it was designed: controlling electronic musical instruments. By "MIDIs" I presume you don't mean MIDI but rather so-called "MIDI Files" (SMF) and the "General MIDI" (GM) spec. This junk was originally designed for consumer-level products like Casio keyboards. General MIDI eventually devolved into the ghetto of cell phone ringtones and other trash. But don't confuse this with MIDI proper, which is a long-lived professional specification controlling often very sophisticated (and costly) devices. Dave Smith -- largely regarded as the founder of MIDI, lamented this recently too. See 00:25 here: https://www.youtube.com/watch?v=RnemYKi8Tb4 https://www.youtube.com/watch?v=RnemYKi8Tb4
- tunesmith 10y agoOne of my favorite discoveries, thanks to a suggestion a teacher made, was how inverting a pattern can help you learn something really difficult. I was learning Beethoven's Appassionata sonata and there's a section where the right hand has a series of five-note arpeggios that gradually decrease in register until the left hand takes over and continues down into the bass (while the right hand takes a climbing melody that originally started in the left). Those five-note arpeggios were really hard in the left hand. So the technique my teacher recommended was to basically play an inversion of the left hand pattern at the same time as the left hand was playing. So when the left hand started on a Db, the right hand started on an Eb an octave up, and then basically play a mirror version - mirrored by the physical key, so E vs C, Bb vs F#, etc. It sounded like crap, but it was very effective - since the right hand is stronger, the left hand would basically learn from the right. Pretty quickly, my left hand got very strong at that pattern and it became one of my favorite sections of the movement.
- organsnyder 10y agoThat's an interesting approach. I might try that to shore up a section of the Widor Toccata (organ) that always gives me trouble.
- Sophira 10y agoThat sounds like a good idea. Props to your teacher - I might try that myself, as there are a few things I've been interested in learning on the left hand but have had trouble with.
- ioseph 10y agoInteresting, flipping Bach's Prelude in C Minor gives it a more major sound. Also inversion is a fairly common technique in writing developments so some fugues will sound quite similar.
- TheOtherHobbes 10y agoThe official way to invert intervals is to subtract the range from 9 (3rd becomes 6th, 2nd becomes 7th, etc) and flip the character (major <=> minor, aug <=> dim, octaves and unisons don't change.) The range is defined by the relationship to the key root, so you need to know the key to do this properly. You can invert at other intervals, which creates inversion plus transposition. See e.g. https://www.teoria.com/en/articles/BWV885/ https://www.teoria.com/en/articles/BWV885/
- stevehiehn 10y agoThis is the concept of 'Invertible Counterpoint'. Which is the extreme discipline of writing harmonies whos roles can be reversed and still sound good. i.e the bassline becomes the melody vice versa. http://www.music.ucsb.edu/faculty/rothfarb/courses/103/invertible-cpt.html http://www.music.ucsb.edu/faculty/rothfarb/courses/103/inver...
- pierrec 10y agoA bit late, but this is not an application of invertible counterpoint. It's closer to melodic inversion (which is also mentioned in the article you linked). Here's an example comparing the two: Source: | Invertible CP: | MIDI flip: | . . | ... | .... | Voice A: . . . | Voice A: | Voice B: | . . | .... | ... | | | | ... | . . | . . | Voice B: | Voice B: . . . | Voice A: . . . | .... | . . | . . | What we see is that invertible CP keeps each voice in its register and switches the melodies by means of simple transposition. Conversely, MIDI flipping forces low-register voices to play in a high register (and vice versa), and heavily transforms the melodies by flipping them (that's the melodic inversion). And overall, invertible CP is rather easy to apply in a composition (I do it all the time!)
- stevehiehn 10y agoInteresting! Thanks for explaining it :)
- Asooka 10y agoIf anyone is wondering how to play a MIDI file on a modern PC without a soundcard that implements the MIDI protocol natively (i.e. pretty much everyone), you need VLC (and on Windows, you need VLC 3.0 nightly build - https://nightlies.videolan.org/build/win64/vlc-3.0.0-20170203-0447/ https://nightlies.videolan.org/build/win64/vlc-3.0.0-2017020... ), plus the soundfont from here: http://www.schristiancollins.com/generaluser.php http://www.schristiancollins.com/generaluser.php . Then, just configure it as explained in the wiki - https://wiki.videolan.org/Midi/ https://wiki.videolan.org/Midi/ .
- conical 10y agoBuilt in Windows Media Player on Windows 10 plays MIDIs fine.
- bcook 10y agoCan I assume you have a trust-fund buffering your insolence?
- anotheryou 10y agoI still want a midi tool that lets me re-do the timing manually: Have a melody, discard all timing info, place/record melody by just tapping on the spacebar. I wonder how synthesizer music sounds when it's all human timing.