Midi Create

10 replies [Last post]
Tiodargy
Title: NooBot
Joined: 07/22/2012
Posts:
BotPoints: 37
User offline. Last seen 3 years 44 weeks ago.

At workshop, the instructors always teach us how to play music on the create. Many people think this is a cool feature, but are limited by the difficulty of actually hand-writing individual notes to a .c file.

Here's my showcase:

Midi Create
George Gregos-Mourginakis
Tri-Desert Robotics

Midi Create

Midi Create is a program that converts .midi files into a music .c file the Create can play. You can use it to have the create play your favorite songs, just by selecting a .midi file and choosing which instrument track you would like to convert. Amaze and entertain your robotics audience with an upbeat song while you’re winning!

Java is an excellent programming language that gives a cross-platform runtime environment for any of its applications. This means that it works on Macintosh, Windows, and many Linux distributions. Not to mention, it offers a wide range of integrated code for use with .midi files. This makes it a great choice for making the Midi Create program.

The program first starts out by asking the user for a .midi file. After the path is specified, it gives the user a list of instruments to chose from. Depending upon which instrument track is selected, the program writes a .c file containing which notes and how long they are played. These .c files can be compiled and run by any create with a CBC.

I created Midi Create to give teams an easy way of converting their favorite .midi files to be played on the Create. This program will entertain the audience with music, and help make your robot the center of attention!

This program may sound like it will make your robot more popular, and don't be mistaken, it will; however, there are some downsides:

First off, the current song writing from the CBC to the Create only allows for 16 note songs. Because of this, I had to truncate the user's song into mini, Create compatible songs of 16 notes, which is why you get the delay every so often (you'll see what I mean if you test it out).

Second, many midi files today are comprised of chords, which are multiple notes playing at once. The create can only play one note at a time, so whichever MIDI file you are transcoding needs to contain a melody. For example, the Tetris theme song, or some other type of early-ish music. Sorry, dubstep fans, but this is NOT GUARANTEED TO WORK WITH EVERY MIDI SONG.

Keep in mind that you might not select the right sequence the first time, and the Midi Create program does require a bit of guess-and-check. Usually, there are many different instruments playing within a midi file and you need to select which melody to use. Midi visualizers such as Synthesia come in handy when doing this.

You're probably wondering where you can download this program to test out. I've provided a link on mediafire (for the time being) of the actual project and the source code here, or as well as file attachment on this entry. PLEASE READ THE REST OF THIS POST, OR YOU WON'T KNOW HOW TO USE THE PROGRAM.

Because this software is still indev, it will be a bit confusing to use. Here's a quick tutorial on how to use it:

Because the program doesn't have a GUI, you have to launch it through the command line as a jar:

In Windows, open up command prompt and navigate to the directory where you have midiCreate.jar and your desired MIDI file with the "cd" command.

In Macintosh/Linux, launch terminal and navigate to the directory where you have stored midiCreate.jar and your desired MIDI file with the "cd" command.

****From now on, the instructions are going to be the same for each operating system****

In your command prompt type "java -jar [jar filename]". For example, "java -jar midiCreate.jar". This will start the program.

Keep in mind that YOU NEED TO HAVE THE MIDI FILE IN THE SAME DIRECTORY AS THE JAR FILE FOR THE PROGRAM TO WORK. I am planning on fixing this bug in a later version, but you're going to have to deal with it now. Sorry!

Now the program will ask you for the path of the midi file. All you need to do is give it the name of the midi, ending with ".mid" YOU DO NOT GIVE THE PATH OF THE MIDI.

From here, the program will ask you which song array to write the song too. For default, select "0" for the first array, and "1" for the second.

From now, the program is guess and check. You will need to find which sequence is the melody that you want to use, and select the channel that seems the most prominent afterwards.

Good luck, and happy transcoding.

AttachmentSize
midi_create.zip9.17 KB

-Tiodargy

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 3 years 43 weeks ago.

It would be interesting to integrate this directly into the Java API on the CBC/Next Gen Controller so you could use a MIDI file without conversion. Hmm....

Interesting work.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

Tiodargy
Title: NooBot
Joined: 07/22/2012
Posts:
BotPoints: 37
User offline. Last seen 3 years 44 weeks ago.

Great!

It would be really nice to see something like my program be able to transcode midi files directly on the CBC or Rambootin(edit: Kovan)! I think that playing music on the Creates at tournament should be encouraged to make Botball even more lively than it is now.

-Tiodargy

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 3 years 43 weeks ago.

No! Call it anything but Rambootin!! I prefer Kovan :P

I have this quote from David hanging on my office wall: "My Rambootin takes too much time bootin it must need more RAM."

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

Tiodargy
Title: NooBot
Joined: 07/22/2012
Posts:
BotPoints: 37
User offline. Last seen 3 years 44 weeks ago.

Haha, that's a funny quote!

At the feedback sessions, Dr. Miller referred to the "Kovan" as the "Rambootin."
Personally, I also prefer Kovan - even though I first learned about it as being a Rambootin.

If there's ever a vote between Rambootin and Kovan, count me in as voting for Kovan!

-Tiodargy

Tiodargy
Title: NooBot
Joined: 07/22/2012
Posts:
BotPoints: 37
User offline. Last seen 3 years 44 weeks ago.

I'm going to clean up the code, it's actually is still in alpha versions... I've left it at 0.0 - for the showcase.

The UI definitely needs more work, and I'm going to use more comments so people who want to use it in their projects don't need to reverse engineer it!

I'll have a lot of time on my hands over the plane ride from GCER, so expect me to be done with this over the next 3-4 days - a week just to be safe.

-mourginakis

-Tiodargy

Gravity Cat
Gravity Cat's picture
Title: NooBot
Joined: 07/21/2012
Posts:
BotPoints: 4
User offline. Last seen 5 years 10 weeks ago.

This was a great showcase George. I'm working on finding a really good song for my create to play (however I lack a create).

Gravity Cat not Amused.
-Zach Nelson

garrettsickles
garrettsickles's picture
Title: NooBot
Joined: 12/08/2011
Posts:
BotPoints: 52
User offline. Last seen 3 years 39 weeks ago.

This sounds like a fun project to attempt in C! Might you be an expert at parsing notes from .mid files? Kidding! I'm going to go work on that parser now.

Garrett Sickles
807Robotics: A Narwhal's Revenge
Youth Advisory Council
Geophysics & Computer Science

Tiodargy
Title: NooBot
Joined: 07/22/2012
Posts:
BotPoints: 37
User offline. Last seen 3 years 44 weeks ago.

Version 0.1!

Sorry I've been gone so long - just been quite busy.

I've cleaned up my source, not by adding comments, but removing unnecessary ones and getting rid of spaces between while loops and such.

Expect me to add more comments in the code soon - it's still a bit hard to read, but by cleaning it up just now, the source is easier to modify.

Download here.

-mourginakis

-Tiodargy

RONNCC
Title: NooBot
Joined: 04/22/2012
Posts:
BotPoints: 2
User offline. Last seen 4 years 38 weeks ago.

Ehh I haven't personally read the specs but what does Rambootin have in the way of audio equipment? What are the specs of its speakers - I assume it has some. I don't know if anyone would like just beeps in the way of music.

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 3 years 43 weeks ago.

The Kovan has a speaker. I sometimes use it to play music in my office. It can get fairly loud, and sounds much better than the awful CBCv2 speaker.

n/a