The Digital Audio Jukebox server software is written in Perl, and runs under Linux. It uses MPG321 (or the original, MPG123) as the MP3 playback engine, and playlists and MP3 file information is stored in a MySQL database. I use MPG321 because MPG123 seems to have a problem with VBR MP3s - audio output is fine, but the status messages (time elapsed etc) jump around all over the place.
You need to install the following packages on your server:
Perl + modules: Audio::Mixer,
MPEG::MP3Info, DBI/DBD mysql
MySQL
mpg321
In Debian (why use anything else?)
you can type the following to install the packages (apt
will find all the dependencies and get them automatically):
apt-get install
mysql-server mysql-client mpg321 libc6-dev gcc make ncftp nfs-common
aumix
You may already have some of these
packages, but I like to start from a completely basic Debian Woody
install (skip dselect and tasksel) and install only the packages I
need. That command will get everything you need to run the Jukebox:
ncftp - For retreiving the Perl modules from CPAN
libc6-dev - Header files required by Audio::Mixer
make & gcc - For compiling the Perl modules
nfs-common - If you want to mount remote NFS partitions
aumix - Tool for setting mixer volumes, useful for testing but not
required
To install the Perl modules from CPAN
type:
perl -MCPAN -e
'install Audio::Mixer, MPEG::MP3Info"
If you get asked if you are ready for manual configuration,
just say no and it will work everything out automatically. You'll be
prompted about unsatisfied dependancies, just answer 'yes' to all of
them.
Then you need to download the Digital Audio Jukebox software. The following files are included in the distribution:
daj-server.pl | main server program |
daj-client-perl-tk.pl | Perl/Tk GUI client |
daj-client-lirc.pl | lirc/daj interface client |
dbsync | populates/updates the database with mp3 information (called by daj-server.pl or standalone) |
zones.conf | config file required by dajserver.pl |
make_emu_routes.sh | script to create the MySQL tables |
gpl.txt | The GNU General Public License |
known-bugs.txt | List of known problems |
Ok, now you want to make sure you can
make your soundcards work in Linux. If you use the Soundblaster Live
5.1 card you can load the emu10k1 module which is included with the 2.4
kernel, or you can get
the driver from Creative Labs.
Depending on the numbers of cards in your system you may have to create some more dsp and mixer devices - you need 2 dsps and 1 mixer for each SB 5.1 card. I have 3 SB 5.1 cards in my system, but only had /dev/dsp, dsp1, dsp2 and dsp3, although I had /dev/mixer thru mixer3. You must use the mknod command to create the extra devices, then set the permissions, e.g
mknod
/dev/dsp4 c 14 67
mknod /dev/dsp5 c 14 83
chgrp
audio /dev/dsp4 /dev/dsp5
chmod ug=rw,o-r /dev/dsp4 /dev/dsp5
You then need to split the front/rear outputs on the SB 5.1 to separate dsp devices, and create a mixer volume control for each. To do this you can use the emu-dspmgr program, which is part of the emu-tools package from Creative Labs. I have provided a script called make_emu_routes.sh that uses the emu-dspmgr and emu-config tools to split the front and rear outputs onto separate dsp devices, for 3 SB 5.1 cards:
# Configures front/rear outputs on a Soudblaster Live! 5.1 to use separate dsp devices
DSPMGR="/usr/local/bin/emu-dspmgr"
EMUCONFIG="/usr/local/bin/emu-config"
#First card
MIXER="/dev/mixer"
$EMUCONFIG -M $MIXER -d #Use SPDIF digital output
$EMUCONFIG -M $MIXER -B on #Turn on the 12db boost on front analogue
output (headphones)
DSP="/dev/dsp"
$DSPMGR -D $DSP -M $MIXER -v"Pcm L:Front L" -mpcm_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm R:Front R" -mpcm_r
DSP="/dev/dsp1"
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 L:Rear L" -mpcm2_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 R:Rear R" -mpcm2_r
#Second card
MIXER="/dev/mixer1"
$EMUCONFIG -M $MIXER -a #Use analogue output
$EMUCONFIG -M $MIXER -B off #Turn off the 12db boost on front analogue
output
DSP="/dev/dsp2"
$DSPMGR -D $DSP -M $MIXER -v"Pcm L:Front L" -mpcm_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm R:Front R" -mpcm_r
DSP="/dev/dsp3"
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 L:Rear L" -mpcm2_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 R:Rear R" -mpcm2_r
#Third card
MIXER="/dev/mixer2"
$EMUCONFIG -M $MIXER -a #Use analogue output
$EMUCONFIG -M $MIXER -B off #Turn off the 12db boost on front analogue
output
DSP="/dev/dsp4"
$DSPMGR -D $DSP -M $MIXER -v"Pcm L:Front L" -mpcm_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm R:Front R" -mpcm_r
DSP="/dev/dsp5"
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 L:Rear L" -mpcm2_l
$DSPMGR -D $DSP -M $MIXER -v"Pcm1 R:Rear R" -mpcm2_r
You can modify this to suit the
number of SB Live cards in your machine, and choose either
analogue/digital output, and enable/disable the headphone boost for
each card. In each mixer it creates the volume controls pcm and pcm2,
which are the 2 dsp devices, front and rear. You can test you have
these new controls by running aumix for each mixer device, for example:
aumix -d /dev/mixer1 -I
Then you can try using mpg321 to play
an mp3 to any of the /dev/dsp devices you have:
mpg321
/path/to/my/songs/song.mp3 -d /dev/dsp3
If that all works, then it's on to the next step.....
MySQL config. You can run the
following command to create a user and the necessary tables (Of course
if you have set a password for mysql you must specify it on the command
line):
mysql <
create_mysql_tables.sql
Then populate the database with your
song information using dbsync.pl:
dbsync.pl
/path/to/my/mp3s
Now edit zones.conf to set the mixers and dsp devices for each zone, and the description that will be displayed in the client. The <index> field must be a sequential number, or wierd things will happen. My zones.conf looks like this:
<index>:<Description>:<mixer>:<mixer
channel>:<output device>
0:Headphones:/dev/mixer:pcm:/dev/dsp0
1:Living Room:/dev/mixer:pcm2:/dev/dsp1
2:Bathroom:/dev/mixer1:pcm:/dev/dsp2
3:Bedroom:/dev/mixer1:pcm2:/dev/dsp3
4:Dining Room:/dev/mixer2:pcm:/dev/dsp4
5:Kitchen:/dev/mixer2:pcm2:/dev/dsp5
Fire up server.pl, and you're ready to connect using one of the clients.