[FUN] ahMIDI - Play MIDI Files and Sequences on Note Blocks

Discussion in 'WIP and Development Status' started by ahmeni, Feb 6, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    ahmeni

    This project is dead.

    Thanks for all the support while I was working on it but I have moved onto other things to develop poorly. If, by some grace, you require lessons on how to be a terrible programmer then the source is available in the linked GitHub below. My final contribution to this project will be my consumption of enough whiskey to forget everything I've learned in Java.


    Had a couple people ask for a pre-alpha release and so I put up the .jar and source on GitHub.

    Homepage
    Download 0.3 JAR
    GitHub Source
    MuseScore - Useful third party application to see what's happening in a MIDI file in case of issues.

    How it works:
    • Place a Note Block
    • Place a Sign facing away from the Note Block with an appropriate [MIDI] or [SEQ] tag
    • Lead redstone wiring to the Sign
    • Activate!
    • Use "/midi stop" if you'd like to end the MIDI before completion.
    Sign format:


    Code:
    [MIDI]
    filename.mid
    1
    
    First line is the midi tag, second line is the midi filename. The .mid file needs to be in a directory under plugins called midi. The final number is the track number.
    Track numbers are dependant on the MIDI file itself. You'll need enough note blocks to cover all the important tracks. I have a 23 track setup as my test bed and I've found it adequate enough to cover most .mid files I find (Apart from the Duke Nukem theme, which is a whopping 73 tracks!).

    Right now instrument matching is simplistic and only a few instrument types are guessed. All MIDI MetaMessage events are interpreted for an instrument change and if ahMIDI can find a suitable block sound in Minecraft then the block underneath will be changed. Melodic tracks without a lot of fancy instruments work best at the moment.

    Code:
    [SEQ]
    1,2,3,4,5,6
    
    First line is the Sequencer tag, second line is the note numbers as per the Minecraft Wiki. Notes will play sequentially with a delay of 200ms each. No method for pause/custom delay at the moment.

    Issues
    • The code needs work. Dear lord am I ever awful at Java.
    • MIDI tracks do not have a method to sync up with each other so multiple tracks will experience a desync if activated at different times.
    • Sequencers need a pause, repeat and more than one line of notes.
    • More accurate scale matching.
    • Signs currently activate on both turning on and off current. Use a lever to make it work properly until this is resolved. Fixed in 0.2
    Here's a demo of the EarthBound credits:





    A big thanks to:
    • sk89a - Helped with some coding and his example was a big help.
    • DarkGrave - Helped with some early testing
    • demanusflint - For his amazing MIDIcraft work.
     
  2. Offline

    Nijikokun

  3. Offline

    ahmeni

    Currently trying to fix the issue with it triggering while off. The songs that trigger when it flips off are messed up too and I think that's why the demo video is a little janky.
     
  4. Offline

    SoapFlakes

    Oh, this is magic. [​IMG]
     
  5. Offline

    unrivaledneo

    Trying to get this to work with a Star Wars theme, though keeps only wanting to play one 1 track, maybe i just am using a wrong midi?
     
  6. Offline

    ahmeni

    You'll want to check the MIDI file to see if it has more than one track. Otherwise make sure you have a sign/noteblock for each track you're using. I use MuseScore to look at MIDIs locally to see what's up with them. I'll put the link in the OP as well.

    Version 0.2 Released
    I fixed the issue where turning off the redstone current triggers the signs.
     
  7. Offline

    Seta

    Always getting Errors like those:
    Code:
    Track:
    
    Attempting to open sp.mid
    DivisionType: PPQ
     ticks per ms: 1.0milliseconds
     Tracks: 18
    Track 2:
    Playing MIDI track of 93 notes.
    Attempting to open sp.mid
    Exception in thread "MIDI" java.lang.NoSuchMethodError: org.bukkit.block.NoteBlock.play()Z
        at com.ahmeni.bukkit.sample.MidiThread.run(NoteThread.java:93)
    DivisionType: PPQ
     ticks per ms: 1.0milliseconds
     Tracks: 18
    Track 3:
    Playing MIDI track of 4 notes.
    Attempting to open sp.mid
    Exception in thread "MIDI" java.lang.NoSuchMethodError: org.bukkit.block.NoteBlock.play()Z
        at com.ahmeni.bukkit.sample.MidiThread.run(NoteThread.java:93)
    DivisionType: PPQ
     ticks per ms: 1.0milliseconds
     Tracks: 18
    Track 4:
    Playing MIDI track of 842 notes.
    Exception in thread "MIDI" java.lang.NoSuchMethodError: org.bukkit.block.NoteBlock.play()Z
        at com.ahmeni.bukkit.sample.MidiThread.run(NoteThread.java:93)
    Attempting to open sp.mid
    DivisionType: PPQ
     ticks per ms: 1.0milliseconds
     Tracks: 18
    Track 1:
    Playing MIDI track of 4 notes.
    Attempting to open sp.mid
    Exception in thread "MIDI" java.lang.NoSuchMethodError: org.bukkit.block.NoteBlock.play()Z
        at com.ahmeni.bukkit.sample.MidiThread.run(NoteThread.java:93)
    DivisionType: PPQ
     ticks per ms: 1.0milliseconds
     Tracks: 18
    Track 0:
    ----------NEW BPM: Z
    Track: Z
    
    
    Please Help :/
     
  8. Offline

    ahmeni

    What version of CraftBukkit are you using (Check with /version)? It looks like it's missing the NoteBlock.play() method and it might have been a more recent addition.
     
  9. Offline

    BigMoomba

    Its a nice plugin ^^ but its not work for me XD
    I have made 26 Jukeboxes and have test 4 midi files but if i turn the it on the noteblocks do nothing XD


    here a pic:
    [​IMG]
     
  10. Offline

    ahmeni

    It looks like it's set up correctly in-game.
    Do you get any messages in the console when activating the redstone? The plugin is pretty noisy at the moment and should spit out a whole bunch of info about tracks and playing a # of notes. Also once activated if you perform "/midi list" in-game it should show a list of threads in the server's console output. You'll want to see multiple threads called "MIDI" once activated, preferably one for each track that actually has notes in it.
     
  11. Offline

    unrivaledneo

    I know it wont work with the newest build of Bukkit. I get no error message or nothin, and the only new plugin was multiverse.
     
  12. Offline

    BigMoomba

    if i make /midi list i dont become any message ingame but in the console this is coming:

    Reference Handler
    Finalizer
    Signal Dispatcher
    Attach Listener
    Thread-1
    Server thread
    DestroyJavaVM
    Thread-2
    Listen thread
    Thread-3
    Timer-0
    Timer-1
    Timer-2
    Timer-3
    Connection #0 read thread
    Connection #0 write thread
    There are 16 MIDI threads running.
     
  13. Offline

    ahmeni

    Yeah, doesn't seem to be working with the latest Bukkit build. I'm investigating!
    --- merged: Feb 10, 2011 3:27 PM ---
    Should be fixed in 0.3 now!
     
  14. Offline

    unrivaledneo

    Works for me now nice! Now just gotta find a better Midi file.
     
  15. Offline

    ahmeni

    @unrivalneo I'm glad to hear! I find simpler stuff tends to work a little better. 120 BPM and 7-10 tracks seems to have the best result.
     
  16. Offline

    unrivaledneo

    Yea, its sounds a bit laggy sometimes but may just be my connection, great work keep it up!
     
  17. Offline

    chibirubara

    I made a short video for ya (only 30 seconds, because of fraps trial).
    Feel free to do whatever with it, I've really enjoyed playing around with your plugin. :D
    It seems like the NES songs work best, overall. Super Nintendo and N64 are a lot more complicated, and hold notes too long in most cases. Anyways, this is from the original NES Zelda, enjoy!

     
  18. Offline

    ahmeni

    Thanks for the support! Sounds good!
     
  19. Offline

    chibirubara

    I support all the plugins I really like, your simply sturs up some wonderful S/NES-talgia, and a video documenting it really is the only thing that does it justice. I do hope you get moved out of this section of the forums soon tho, so more servers start using this amazing plugin you've come up with. I already have players flying around on airships (via the Movecraft Plugin) with music built into them, spreading the wonderful sounds of classic gaming around the whole server! Keep it up man!
     
  20. Offline

    Samuel

    Hey, I'm having a bit of trouble. How do I find out the amount of tracks that my mid file has in MuseScore?
    Could someone post a tutorial?

    Thanks
     
  21. Offline

    chibirubara

    I didn't play with MuseScore, but if you try playing the midi in-game, it'll tell you how many tracks it has in console.
     
  22. Offline

    telnoratti

    I got a weird bug where when i used a noteblock to play a midi track, the block underneath it becomes dirt.

    Great plugin though, I love it.
     
  23. Offline

    ahmeni

    This is intentional. Minecraft determines the sound of a noteblock based on whatever block is below it.
     
  24. Offline

    jfmherokiller

    using the levers to stop the music does not work for me it also makes the audio overlap when i toggle the lever of the same song.
    here is a video of the song lady gaga poparozi i made using your plugin

    the reason why i used 1 note block is because i am used to transcribing midis into the garrysmod e2 midi format which only allows 1 track.
     
  25. Offline

    ahmeni

    Unfortunately only /midi stop is supported for stopping tracks. Cutting redstone power will be supported in the future, which should hopefully should address the overlapping music. It's good to see someone putting it to use though!

    Development on the plugin has slowed a great deal over the last while. With the new changes to the scheduler the plugin will need some reworking to be compliant with newer plugin standards and I've been sidetracked by another Bukkit project recently. Let me know if anything breaks in newer builds and I'll be sure to make sure it still runs.
     
  26. Offline

    ryanteck

    got it working on my server - can anyone give me links to GOOD midi files?
     
  27. Offline

    hillage

    EDIT: AGAIN: Never mind, I'm an idiot. I created the midi folder, it works fine. Great plugin! Can't wait for the kinks to be worked out, it'll be awesome.
     
  28. Offline

    Xstasy

    Broken with CB Version 446+
     
  29. Offline

    ahmeni

    @Xtasy I'll give it a shot and see what's causing the breakage.

    edit: Working on 463. What's not working for you? Are you seeing any failures in the server console?
     
  30. Offline

    WMisiedjan

    Hmh Mario Bros isn't Working :( Anyone that has a awesome 8 bit song?
     
Thread Status:
Not open for further replies.

Share This Page