X

Geertjan's Blog

  • March 5, 2006

MIDI Editor for NetBeans IDE

Geertjan Wielenga
Product Manager
I've built a very simple editor plugin module for NetBeans (although the editor could very easily also be a standalone application) that produces files that conform to the MIDI Specification. Laying the basis of this editor was incredibly simple—thanks to the wonderful JFugue, which is an absolutely transparent Java API for Music Programming, in combination with the NetBeans IDE's plug-in module development support. Among other cool features, the JFugue API provides a very simple syntax, which it is able to convert to a MIDI file. NetBeans IDE is great, because it very easily lets you build a user interface for the JFugue API, accessing whatever subset of the API you want to implement.

I am very far from finished (also because this is just a prototype and I'd like to completely re-implement it, using the NetBeans Palette API), but here's what it looks like so far:

If you want to see the MIDI Editor in the context of the entire IDE, click here.

Even though it is only a simple prototype, the MIDI Editor can already do a lot:

  • When you select any of the items that you see in the listboxes, the related sound is produced for all the current selections. So, for example, when I select a different instrument in the Instruments listbox, the sound for that instrument is produced, the note, octave, and length being determined by the current selections in the other listboxes. The same is true for all the other listboxes—make a selection anywhere and a sound is produced that matches all the current selections.

  • When you click the smiley face in the toolbar, all the current selections are put in the editor (which, as you can see, has rudimentary syntax highlighting—only the instrument and the note are currently supported). You can then go back to the listboxes, make different selections, and then click the smiley face again. Each time you click the smiley face, the current selections are added to the editor. Other features of the editor:

    • You can press Enter in any listbox and then whatever is the current selection in the listbox is added to the editor.

    • You can click the Duplicate checkbox (which needs to be reimplemented as a button), and then the current content of the editor is duplicated. (By using this function, you can very easily create a longer tune.)

    • You can move the slider and generate syntax for setting the speed of the subsequent code.
  • When you click the singing face, the complete current content of the editor is played. By the way, to see for yourself how wonderful JFugue is, take a look at how simple the code is that plays the content of the editor:

    Player player = new Player();
    Pattern pattern = new Pattern(MidiEditor.getText());
    player.play(pattern);

  • When you click the save button, the current content of the editor is saved in MIDI format. You can then go into your filesystem and you'll find a MIDI file, which you can then play like any other MIDI file, using RealPlayer or some other similar player.

  • When you click the sad face, the current content of the editor is cleared and you can begin filling it afresh.

I've added the example tunes that come with the JFugue documentation. Below the editor, you see a short list of these. When you select any of the items in the list, the related tune is immediately played.

I don't think it should be very difficult to reimplement this user interface in such a way that notes, on buttons, can be dragged and dropped onto a music sheet implemented in a topcomponent. That's the next feature I'd like to implement. Also, code completion in the editor would be a very cool enhancement.

By the way, it took me about a day and a half to implement this user interface for MIDI and JFugue (without knowing anything about either MIDI or JFugue when I started). Anyone who knows me knows that I am definitely not a programmer. And, therefore, I think that this says a lot for the simplicity of JFugue and the productivity of NetBeans IDE.

Join the discussion

Comments ( 3 )
  • Seapegasus Sunday, March 5, 2006
    Hahaha, w000t! :-D
    But it seems JFugue can't load existing MIDI files yet to edit, and I don't see anything about channels/tracks either. :-( Cause I've got some ol' MIDI files and want to remove the boring drum track and can't figure out how... ;-)
  • Seapegasus Tuesday, March 7, 2006
    Answering to myself: The next version of JFugue (3.0) will support opening MIDI files too. Gotta keep an eye on that.
  • arie Thursday, August 26, 2010

    dear Geertjan's

    how to install MIDI editor in netbeans 6.8

    please describe,

    best regard

    arie


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.