2008/01/28


Scripts for the Midnight Commander crossjazz DJ thing

Since the public asked for it, here are the scripts I use to load the stuff in my system. (I hope to make a small page to let everything there soon.)

the scripts reside in /usr/local/bin. I write files at /var/local/ to know whether there is already a song playing at each track. The first script just opens xterm with mplayer in it, and after the song is over, erase the signal file at /var/local/

nwerneck@cyberon:~$ cat /usr/local/bin/CJa
#!/bin/bash
(xterm -T CJa -geometry 80x12+10+400 -e mplayer -ao jack:port=inA "$1"; rm /var/local/crossjazzA) &

nwerneck@cyberon:~$ cat /usr/local/bin/CJb
#!/bin/bash
(xterm -T CJb -geometry 80x12+510+400 -e mplayer -ao jack:port=inB "$1"; rm /var/local/crossjazzB) &


Notice that "inA" is the name of the A input ports of my jack / gtkmm application, that I named crossjazz. You can change this for the name of a port in another crossfade program you want... You don't even need a crossfade application, actually, you can happily do a DJ job just playing thing straight to the system output... You don't even need jack!... But of course, it depends on what you want to do... Suit yourself. And also notice that the "geometry" parameter opens the windows at proper (configurable) places.


Next script tests the files and opens the next available track (first tried is A)
nwerneck@cyberon:~$ cat /usr/local/bin/CJ
#!/bin/bash

if ( ! test -e /var/local/crossjazzA ); then
CJa "$1";
touch /var/local/crossjazzA;
else if ( ! test -e /var/local/crossjazzB ); then
CJb "$1";
touch /var/local/crossjazzB;
fi; fi;


Then you must configure Midnight Commander's bindings file to call CJ when trying to open music files, for example:

regex/\.([oO][gG][gG])$
Open=CJ %f
View=%view{ascii} ogginfo %s

regex/\.([mM][pP]3)$
Open=CJ %f
#Open=run-mailcap audio/mpeg:%f
#Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f &); fi
View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/Title:/,/Comment:/p;/^MPEG/,/^Audio/p'


Last thing to configure is VTWM. Here are the important lines:


"F5" = : all : f.warpto "mc*"
"F6" = : all : f.warpto "CJa"
"F7" = : all : f.warpto "CJb"
"F8" = : all : f.warpto "crossjazz"


Where crossjazz is my mixer application. Notice that the xterm windows had to be properly named for this to work.

I'll post the crossfade code some day now!... Stay tuned! :) I'll make a small page for it. I want to make a compressor... The songs have sooo much different volumes! :(

***

Este post é pra publicar os scripts do meu revolucionário sistema de discotecagem baseado no midnight commander!...

1 comment:

hardbop200 said...

Outstanding! Thank you so much for posting these...
FYI, I'm in the process of making a "jack tools" module for dyne:bolic (http://www.dynebolic.org/); I'm going to be including a lot of small jack tools, and I wanted to include this, but needed the scripts to drive it. I'll be sure to let you know when I have the module done. Thanks again! -Josh