Notes:
Some notes to release 0.11
----------------------
what do we have here? what is this anyway?
in short:
- elements to create a mysql-database with information about audiofiles. the
structure of the database comes from how it looks in Digimedia
(www.studer-digimedia.com) as that's where i exported the information for my
use.
- a perlscript that plays these songs (using mixplayd.sourceforge.net)
either randomly or according a queue residing in mysql db "jukebox" through
the local soundcard. songs do overlap, each song X has an individual point
in time, called EOM in the database with the information about the
audiofiles, where it starts to fade and at the same time song X+1 is
started. streaming may be supported by mixplayd; i haven't tried it.
- a php-page that gives you a module for postnuke 0.64 to browse the
song-database, and let registered useres add songs to be played into the
above mentioned queue
extended version:
jukebox-0.95.tar.gz
a jukebox with a webfrontend, using cgi-s and mySQL, written by Roland
Steinbach (roland@netzblick.de). it creates and uses database "jukebox".
soundfile.sql
creates table soundfile in db soundbase (doit with "mysql < soundfile.sql").
you have to create db soundbase beforehand.
filein.pl
reads a textfile containing tab-separated information about audiofiles in
the format of demodata.txt, and enters it into table soundfile of db soundbase
demodata.txt
a bunch of lines, containing tab-separated fields about audiofiles. this is,
as the name implies, demodata...
dj.pl
a perl-script that uses mixplayd (http://mixplayd.sourceforge.net) to
play the audiofiles known to table "soundfile" in database "soundbase"
either randomly or according to table "queue" of database "jukebox"
jukeindex.php
actually this must go as file "index.php" into "modules/Jukebox/" of an
installation of postnuke version 0.64 (later versions untried,
www.postnuke.com) and give a php-based webjukebox, that knows the songs from
db "songbase" in table "soundfile" and stores the requests of the public in
db "jukebox", table "queue".
TODO
- clean this mess up even more and chase the german out of the files
- create a reasonable interface to add / edit the db soundbase (sure you can
always do it with phpmyadmin (see www.phpmyadmin.net)
- work many more steps toward the goal of ross.sourceforge.net...
- write an interface to all of this in perl/Tk for a) the on-air-studio and
b) some edit-stations in the radio
to understand this mess, maybe you need to know its story:
first i wanted a webbased jukebox. then i found one at
http://daemon.ratisbona.com (jukebox-0.95), now disfunct, but coming along
with this distribution - for reasons explained later on. then i installed
it, it worked, played around, found it great, but: i wanted to enter all the
2'500 songs already digitized at Radio X (Basel Switzerland, www.radiox.ch)
together with its associated songdata. and wanted to integrate the
webjukebox with the then new postnuke-based website of Radio X. how this?
Radio X in Basel uses Studer Digimedia (http://www.studer-digimedia.com/) as
radio automation tool. it runs almost flawlessly 24/7 since 1998 on Windows
NT. I wanted to create something similar, maybe even better, on GNU/Linux
under GNU/GPL. http://ross.sourceforge.net was born. So to start the experiment,
first i backed up all the soundfiles being in MP2-Format from the NT-system
to my Linuxbox (about 22 GigaB).
Then I exported the information about the songfiles in the
Digimedia-database to a Textfile, with the info tab-separated, one line per
song, and transferred the file to the linuxbox. a small part of this you can
find in "demodata.txt" for your own experiments.
Then I created an empty mySQL-database named soundbase (use e.g. phpmyadmin for this from
http://www.phpmyadmin.net/) containing a table with the exact same structure
as the data coming from Digimedia (do it via "mysql < soundfile.sql").
Then I wrote a perlscript that reads the textfile containing the info about
the soundfiles and enters it into the database/table soundbase/soundfile (run
filein.pl, but first edit it for your needs).
SO NOW I HAD 2 MYSQL DATABASES, EACH WITH SEVERAL TABLES:
one database from installing jukebox-0.95, called "jukebox", and one database from importing
the digimedia-data, called "soundbase".
after some fiddling around i got jukebox-0.95 to give me a webfrontend to
the 2500 songs imported from Radio X. in this setup, i used both databases,
as jukebox has for example a table called "queue" or one callled "np", that
i still used from the original setup, but i made jukebox look into the
database "songbase" for the songs in the repertoire and so to choose from.
then came www.postnuke.com: i turned the website of Radio X into a "nuked"
site. many reasons for this, one of them: co-workers of Radio X can
contribute content for the site without having to master even HTML.
downloaded and installed postnuke version 0.64, found its principle of
modules. thought: why not integrate the jukebox into postnuke as a module?
so i went out and wrote a php-redesign of some of what jukebox-0.95 did
through cgis. that's where "jukeindex.php" enters. so if you install
postnuke (at least with 0.64 it works, haven't tried a later version, i
admit), create a directory called "Jukebox" in the "moduels" directory of
postnuke, and you copy jukeindex.php to there as "index.php", then you can
use the jukebox in postnuke as a module, that allows registered users to
select songs and place them in the queue. everybody can browse the
repertoire. as seen here:
http://jukebox.radiox.ch/modules.php?op=modload&name=Jukebox&file=index
(in case you have chronologically followed me in installing and creating all
the above, you could do this too...)
nice, but: with a real radio, songs overlap. and each song has a distinct
EOM, a point where its right for the next song to start. I do have this
information from the 2500 X-songs, as the people who entered them into the
automation of radio X have listened in on every one of them and have decided
by ear, where this point is and they have entered this time into the
database, of which i do have a copy in mySQL now, in the field EOM. but the
playing daemon coming with jukebox-0.95 just plays one song after the other.
no overlapping. now that's bad. that's ok for a jukebox in a bar, but it's
not real radio.
what's next?
find something in perl that lets you remote-control a mpg123-process in a
way, that you always know, where in time you are and you can start a second
mpg123-process at the right moment, according to the EOM and last but not
least mix during the overlap the two mpg123-outputs in realtime towards the
soundcard. ("soundcard": i want to hear the result locally, not stream it to
the world. main reason: move away from copyright problems. Radio X is
allowed to transmit via airwaves and pays royalties for this; but streaming
is something different and would cost extra money copyrightwise! mixplayd in
principle is able to work without soundcard and so should be even able to
stream its output to the net. but i'v never tried this one.)
Found MP3::Daemon, fiddeled around, didn't get happy fast enough...
Tried Audio::Play::MPG123, same result. both are great work, but didn't
quite fit my needs and programming-skills.
then found mixplayd (http://mixplayd.sourceforge.net). now this looked
promising: a multichannel realtime mixer and mp3-player, working with a
daemon, that can be talked to from perl.
downloaded it. found that it is designed mainly for mp3-files: it expects
the files used to have id3tags, except when mixing live sources. we have
mp2s, they don't have id3tags, so they give mixplayd a big hickup! now what?
i don't know enough C++ to really change the source, so i thought: why not
fake live-streams? why not send every file to mixplayd via my local apache?
tried it, it worked. only change necessary in mixplayd:
in file "mixplayer.c" i had to change the sample rate to 48000 as that's
what we use
in file "defaults.h" i changed "FADEOUT_SPEED" to "5" from "10", but that's
a matter of taste
and
in the same file changed LIVE_DECODER_OPTS to "-qs" (took away the
1MB-Buffer, thought our system is fast enough to do without)
after that i could start mixplayd no problem with the commandline:
/usr/local/mixplayd-0.54/mixplayd -port 8888 -snddev /dev/audio0 -logfile /var/log/mixplayd.log
but now i had to handle the overlap... so i went back to jukebox-0.95, took
its component called jbplayd.pl, that runs in circles, really playing the
songs, kind of like a dj, and I "remixed" it to "dj.pl".
-----
short intermezzo:
inside dj.pl i take note of the starttime of song X and its duration in file
/tmp/tik.txt
this file in turn is read / used by jukeindex.php (for real use: to be
renamed into index.php and be placed into "modules/Jukebox/" of the
postnuke-installation). it uses this information to calculate an estimate of
the time when each of the selected songs in the queue will start. so i know
approximately when the song i choose will air. of course this could be done
much more elegantly. like so many other things...
end of intermezzo
------
dj.pl
this really is the heart of it all. what does it do? play the dj. meaning:
when there is something in the queue: tell mixplayd to play that song as a
fake livestream via "http://localhost/wheretheaudiois/filename.fileending".
when the queue is empty, play a random song. when the EOM of song X (the one
playing as a fake livestream) is reached, talk to mixplayd: fade song X out,
start song X+1 (sure: as a fake livestream - for the reason mentioned above:
i do have mp2s that mixplayd doesn't like otherwise).
what about recordinglevel? good question. as i do have taken the original
data from Digimedia, for some files i do have a field called "level" with a
value in it. namely for the ones Digimedia has played itself at least one
time. dj.pl does take this entry into account and sets the outputlevel of
mixplayd respectively for each song on the channel it plays on. but: it
can't do what Digimedia does: sense if a song needs some gain or some
fadeing the next time it is played. how would i do this? play and calculate
an average at the same time? i'm too stupid for this.
how could you use all this?
the easiest:
install jukebox-0.95
install mixplayd
install postnuke 0.64 (later version might work, i didn't try)
install jukeboxindex.php as module Jukebox in postnuke
add soundfiles to the system
enter information about the soundfiles in db soundbase, table soundfile
start mixplayd
start dj.pl
you end up with a webfrontend to a jukebox, integrated in a postnuke-site,
that let's everybody browse the repertoire but allows only registered users to put
requests in the queue. the songs are played through the soundcard of your
linuxbox, overlapping as they should...
remember: this is only version 0.1; cleaning and removing of german will
follow sometime
Patrik Tschudin ptschudin@users.sourceforge.net
Changes:
Well I did some cleaning and added some notes in the files in english so non-german-speaking individuals have a slightly bigger chance to understand what's goning on...
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use