Nov 13, 2008

Rock Band Drums in Linux, Part II

I went back to my Rock Band drums code and decided to actually whip something up out of it. It's a tiny little app that uses some OpenGL to render the drum pads, and they bounce and things like that when you hit them. The kick pedal makes everything shake and gives a flash. It's pretty cool.

The link to the code is here:

You can check out the code if you like, I released it under an MIT license so you can really do whatever you want with it.

There are a couple issues still. Mainly is the audio latency can be annoying sometimes, as it gets to be a half second off. Since I don't know much about programming audio, I can't fix it too much, but I'm doing my research and will try to get this resolved as fast as I can.

I tweaked the old code because there was something making it so that if you hit two pads at once, only one of them plays. This is no longer the case, you can hit as many pads as you like and they will all play.

The code is done with SDL and OpenGL, so it should work just fine on Windows or Mac too, you just need to compile it because I haven't made a compiled version for either of those platforms.

UPDATE (01/20/09): It seems there has been some trouble getting opendrums to compile. On Ubuntu you need the following packages:
  • build-essential - In order to compile C++
  • libsdl1.2-dev - For SDL
  • libsdl-mixer1.2-dev - For SDL_Mixer
  • libgl1-mesa-dev - For OpenGL
On other distributions the package names might be slightly different. On Windows/Mac you'll need a C++ compiler which will likely come with OpenGL, but you'll need to install SDL and SDL_mixer manually - although I believe Mac has some package management system that you might be able to use.


Huntly Cameron said...

Hey, this is awesome! Have you had any luck in sorting out the sound latency issues?

Rob Britton said...

Nope, I haven't really worked on OpenDrums in a while. I did some research into why the sound was slow, apparently sound programming on Linux as a whole sucks ass. I decided to put it off for a while until I have a lot of free time, which hasn't happened yet :)

Huntly Cameron said...

hehe fair one. If you're interested, I found this article:

It works really well as you get all the different drum sounds and can play about with different sound combinations. I managed to use something called JACK to send the output of the Hydrogen drum program into Ardour so you can then record what your playing.