• 6

    posted a message on MIDICraft: Convert MIDI files to Minecraft Note Blocks
    http://www.mediafire.com/?4dvmtx4zzuu1xx2 Download a mostly-working version of MIDICraft! Run 'midicraft.py' as either a GUI (by double-clicking it or running through a command line without any arguments) or a CLI (check 'python midicraft.py --help')


    Hi Minecraft forums.

    I've been working for the past week on a project I'm calling MIDICraft—a Python program that takes MIDI files and converts them to Minecraft maps (via pressure-plate-activated note blocks). There was a lot of nonsense involved (who knew MIDI formatting was such a pain?) and I put way too much time into it, but it's coming along pretty great. Here's the first video I've made, a conversion of Aphex Twin's "Flim" (I made the MIDI myself a few years ago).


    (original )

    The timing is not perfect, of course, since it depends on framerate (which is suffering mostly because of the video recording), but other than that I'm pretty close. The MIDI file was edited a little to fix range problems (that 3-octave limit is kinda rough) and get some better instrument assignments (notice the bass at the end), but other than that was left alone—a MIDI created specifically for conversion could avoid these problems by specifically writing for Minecraft's specifications.

    The code is terrible (and please, could someone who has experience with Python, Tkinter, and compiling or whatever help me to make it a little better?), but works pretty much as follows: mclevel.py is used for all actual manipulation, and someone's midi.py module does the (ugly) MIDI file read. A lot of ugly string manipulation gets the instrument, pitch, and timing information. Note boxes are created as either standalone (for single notes) or nifty redstone staircases (for chords, including notes with drums). The whole thing gets drawn on top of a pathway with pressure plates drawn down the middle for activation and fences to keep pigs out. It took probably around a minute to create the file above.

    I've got a few bugs in this video—right now, there can be simultaneous instances of the same note, which you can hear in the Youtube when there are several simultaneous bass drum hits. These are a result of rhythms beyond the available level of precision being compressed into one step. I can avoid this by only allowing one instance of each note-instrument pair per step, but there's not much to do about its cause short of adjusting player speed (which isn't really what I want the program to be for). Likewise, rhythm tracks only work well at multiples of block speeds (which I measured at around 4 per second). Anything at 60 or 120 bpm is going to be fine (like the example above), but other tempos won't sound right with dense rhythms. Just a melody should work fine, though, since it's not depending on every single step.

    I should also admit that I made a few manual adjustments once the level was generated. I shoveled the snow that had fallen on a few of the note blocks near the end, preventing them from sounding. I also had a few isolated instances of notes not sounding correctly (I'm unsure at this point if they lost the blocks that define their instrument or what), so I just removed those note blocks entirely.

    So far, my GUI allows the user to select the pathway blocks, the staircase blocks, and pressure plate block. Obviously, it needs some sort of file dialog as well, and it'd be nice to have control over what world it manipulates and in which direction (although barreling through World 1's positive X axis is charming). Like I said, though, I'm pretty close! I'll upload the map generation code once I clean it up a little bit more and figure out how to package it into some kind of executable.
    Posted in: Minecraft Tools
  • To post a comment, please or register a new account.