The Midnight Disc Commander

This is the story about how I crated my own DJ system to use in my Linux box. It is based on midnight commander, mplayer and a small JACK/GTKmm application. Here is the screenshot!

Free Image Hosting at www.ImageShack.us

(( If you are interested in computer audio, you might enjoy this text I wrote about a measurement of the filters in an M-Audio Fast Track Pro... ))

I'm about to go to my brother's birthday party, where I'll serve as a DJ for a bit. For the first time I'll use my notebook to play the songs. It is a Compaq with an AMD Sempron 3500+, and has Debian. I'm an old-school guy, and my window manager is VTWM.

There are lots of Linux programs for disc-jockeys. Mixxx and xwax are two fine programs that emulate vinyl turntables, and let you scratch and make loops... Mixxx can be used with joysticks and other specialized hardware. They also measure the BPM of the musics, and let you change the speed, and apply effects... And of course, they have a window for you to select the files you want to load.

I was going to use mixxx, but I decided it was not good for me. I didn't want all the options, and I wanted easier access to do the few things I was going to do: load new songs alternating the tracks, and make a crossfade.

I searched for other Linux program with the "crossfade" and "playlist" features, but most of them only make the crossfade between the currently playing song and the next one, emulating the work I wanted to do by hand.

So, I realised Linux had advanced applications for composer-DJs, and DJ-emulator programs, but no proper application for a humble "just play the tunes" DJ like me... I believe idjc would be the closest to my wishes, but I couldn't run it. Plus it is based on QT, and I prefer GTK, or console applications, possibly with ncurses.

As a JACK fan, I even considered using something as puredata to do the work. But in the end I decided that all I needed was a small program to make the mixing (directed to do just the cross-fading), then I could select and play the songs with other programs. I decided to do something the unix way, full of pipes and running external applications...

I couldn't find a proper simple JACK mixer program, so first I made my own. It has a scrollbar to select the mixing level, and a bunch of radiobuttons to change the mixing style between linear, fixed-then-linear, sudden and quadratic. The jack part just outputs the weighted sum of the two inputs. There is also a simple first-order IIR filter in the scrollbar reading, to make the transitions more continuous and slow.

To load the songs in the two tracks I made two small bash scripts. This was already enough to work from two xterm windows.

Then I started to enhance my general interface. I created scripts that open an xterm windows and call mplayer inside it. Mplayer already lets you pause and move forward, backwards and to the beginning of the song using the keyboard. I created key short-cuts in my vtwm configuration so F6 F7 F8 alternate between the two tracks (mplayer) and the mixer windows.

Finally, to browse through the files and load the songs in the tracks, I decided I wanted something similar to moc... I wanted something like midnight commander... Then I thought: "hey, why not midnight commander itself???" And voilà!... I configured MC to load my magical script when I select ogg or mp3 files!... The result is the screenshot above. The mc window won the F5 short cut, so I never have to use the mouse. Just push buttons, the way I like it!...

It is not enough to use Linux to play your songs, you have to make your own mixer program and make it interact with midnight commander! THIS is a true DJ hacker! ;)

The system worked successfully. The house almost went down with Search and Destroy and Territorial Pissings!... You can see the pictures of the party at my picasa album.

The greatest success, of course, was being cited at Music Thing. Thanks for the attention, guys! :)

I have detailed some more my system at this later blog post. The mixer program is still not in the Internet, but I can send to anyone interested... It's a very basic jack client integrated into a GTKmm application.


Josh said...

Outstanding stuff here. If you don't mind, would you also post some of your magic scripts?

NIC1138 said...

Sure I will!... I want to make a small page to leave the scripts and programs there. But the scripts are really simple, I can post them right now :)

Anonymous said...

JackEQ would have worked just as well - it has two crossfaders built in. I can't remember if it lets you change the curve though..