Installation and Configuration
First, download the newest version of
sTaLMP3Box. I recommend you to choose the precompiled binary, as it isn't too easy and comfortable to compile the source code. But if
you want full optimization or if the binary won't work on your target system (the system that will become the sTaLMP3Box jukebox), then you'll have to download the source code and compile it. Look further below to see how to do that.
Then download all other programs and files needed or wanted.
Here is the list of what you need: (fairly recent versions of many of these programs can also be found on the download page of this site)
And here are the things you could optionally install, too. At least that was what I did and I recommend it to everyone.
And you need, obviously, a correctly installed and configured version of Linux on your target computer. Every distribution should be appropriated, although I used Debian. You could naturally use some of those minimal distributions, to make things easier to install (so you don't have to uninstall all those for this project absolutely unnecessary programs (like X-Window system, kde, gnome, internet and network stuff, etc.) you normally get with a normal installation of the bigger distributions.
The very first thing to do is to install sTaLMP3Box on your target
computer. Copy the tarball to a directory where it is o.k. for you and do a "tar -xzvf" (extract) with it. Attention! No new directory will be created, all files of the tarball will be extracted to the dir where you copied the tarball to! So you should extract the tarball only in an empty directory.
If you downloaded the source code then you have to compile it first.
If you got the binary version then you don't have to read the following instructions and you may proceed to "Now let's continue".
As this program is written in PASCAL, you might encounter some difficulty compiling it under Linux, where C is the most used language. But I'll try to help you making that process easier. The first thing to do is: get FreePascal at www.freepascal.org. That's because I don't know if it is possible to compile it under other Pascal compilers. Anyway, with FreePascal it will be the easiest way, because I can explain it to you. So here we go: After having installed and configured correctly FreePascal (don't ask me for how to do it - go to their site!) - it doesn't have to be on your target computer, as any computer is o.k. for compiling it as long as you select the right target in FreePascal as your target computer (Pentium, K6, 486, etc) - , go into the IDE and open lcddriver.pas. (Alternatively, if you don't have the IDE, you'll have to use the command line compiler, look into the docs of Free Pascal to get the equivalent options and configurations to those described here).
Now, under "Compiler" in the Options-Menu, select the following config:
Delphi 2 Extensions: ON
Allow LABEL and GOTO: ON
All other options are switched OFF!
Under "Code Generation":
Generate Faster Code: ON
Level1, Level2 optimizations: ON ---> but NOT "Uncertain Optimizations"!!
Select a target processor - the one of your jukebox-machine, not your normal pc! ;-)
Nothing selected under "Runtime Checks"
Now save this config and exit this dialog and simply click on Make in the Menu Compile. It will try to compile lcddriver.pas. If it succeeded (it should!!! ;-)), then you'll can proceed to next step. How to compile stalmp3box.pas: Open it into the IDE, and under the same config dialog like described when compiling lcddriver.pas, change the config to the following:
Delphi 2 Extensions: ON
Allow LABEL and GOTO: ON
TP/BP 7.0 compatibility: ON
Delphi compatibility: ON
All other settings are the same like above. Now compile it. When succeeded, you'll get the binary file stalmp3box, which you could immediately execute, it is self-sufficient.
Now let's continue. Copy the binary "stalmp3box" to an appropriated directory on your target machine (could be "/usr/bin" or "/" for keeping things in configuration files simple ;-))
Login as root (or use "su") and run "./stalmp3box". If nothing happens you'll maybe have to do a "chmod +x stalmp3box" first. Anyway, if you got it running it will output something like this:
|ииииииииииииииииииииииии sTaL-MP3Box v.0.9 иииииииииииииииииииииии|
| A complete control program to set up a MP3-Player-Box under Linux. |
|The output of this program is NOT sent to stdout, but to a LCD-module |
|connected to the parallel port. So you need to have that display, |
|if you want to use this software. |
|Copyright (c) 2002 Elias Jahn. All rights reserved. |
|This program is licensed under the GNU GPL v.2 or higher, see the file|
|COPYING for details. This software comes with NO WARRANTY. |
2x16 Line LCD-Display-Module connected to Parallel Port at 378 was
initialised successfully. You should now see a welcoming message on
the display. From now on, this program will stop outputting to stdout
and instead use the LCD.
You should see two processes called stalmp3box. So if this all happened as described here, the first test was done successfully. Now connect the LCD-module to the parallel port, exactly as described on the Hardware-Page. Run sTaLMP3Box again as described above and you should see on the LCD some seconds after starting:
Press h for help
If you do see that, then your display is correctly connected and the program's access to the parallel port works fine.
Now - always in the console or terminal where you're running sTaLMP3Box - press "p" to open the playlist. Then press "f" to get to the filedialog, enter a directory where you have some MP3s stored (using the ENTER and the Backspace keys, cursor keys to scroll, ENTER goes into the directory which appears on the first line of the LCD), now press "d" to add all MP3s in that directory to the playlist. Press "Esc" and you should see the playlist (if not, press "p" again) with the recently added MP3s. Now use the cursor keys and then "z" to play the song in the first line of the actual display. If you hear the music then everything is allright. If not, first check if mpg123 is really working and if your soundcard/volume levels are working or set up, then check if the MP3 can be played with mpg123 from command line. Only if this works and you don't get it to work in my program, only then send me a bug report. But there should not be any problem, as I've thoroughly tested all these normal functions. Please do the same test with some OGG/Vorbis files, if you want your Jukebox to be able to play OGG/Vorbis files. Now go on testing all "normal" functions (press "h" for help). If everything seems normal, then you've made it!
Now let's continue with the Installation of everything else on the target machine.
Installation is all done now! :) Let's proceed with the Configuration.
--Copy the binary "stalmp3box" to the root tree ("/"), as this will make configuration easier.
--If you want to use CDSpeed: Copy the mount-substitution-script for cdspeed, called "mount2" to root tree "/". Don't forget to edit the script and change the line "/cdspeed -d /dev/scd0 -s 8" : substitute "/dev/scd0" with the device of your CDROM-Drive and put the speed you want after "-s" unless you want to use 8x aswell, which I actually recommend you.
--Copy the Init-Script "s20stalmp3box" to the RC-Dir for the Runlevel you use (for example /etc/rc2.d/) or alternatively you can put it into the /etc/rc.boot files.
After having done that, I recommend you proceeding with the installation and configuration of the programs in the section "What you need", above, if you haven't already done that. Here I say it again: Fairly recent versions (you'll have greatest probabilities to get sTaLMP3Box working with these versions, as they are the versions I am successfully using in my "Prototype") of most of the programs are available from my Download Page. If you feel adventurous you could also try newer versions, if available, but don't expect them to work! They might work, but they are completely untested to work with my program (yet). Here are some important hints on how to optimize or install some of those programs:
Get "development"-version 0.59s and compile it yourself on the target machine, it is worth it! And it's quite easy to compile. It's the case, that 0.59r (which ships with most Linux Distros) has some annoying bugs...
If you're using mpg321 then you'll have to add a symbolic link /usr/bin/mpg123 pointing to mpg321 !
I know, there is a slightly newer version of OGG/Vorbis out there than the one on my download page (1.0), but it isn't patched (yet)! I don't know when they'll be adding the Remote-Interface-Patches to their Source. So use the version on my site, it is patched, will compile easily and works 100%. While they don't add the Remote support, I'll probably patch and add to the download page major releases of OGG/Vorbis from time to time to keep things up-to-date. Read the file "REMOTE-PATCHED" in the source tarball of patched OGG/Vorbis from my site for more information.
Copy the binary of it to "/" -- my mount2-script looks for "/cdspeed" ! (Alternatively change the path in my mount2-script, but I don't recommend you that, it's easier with the root, you know, that machine isn't going to serve anything else than playing music, so, Dear Worried-Linux-Administrators: no security necessary!! ;-)
I recommend you the same here. Copy the binary to "/". Then read instructions of SMixer on how to create a config file which will be called on startup to set the volumes, obviously you'll have to configure sTaLMP3Box to load the mixer with right parameters at startup (look below in "Configuring sTaLMP3Box" to see how to do that). But I actually don't recommend you to use OSS/Free, instead of it, use ALSA! (even though it is perfectly possible to use OSS/Free with sTaLMP3Box and the other programs, I am actually using OSS on my Prototype! But I'm thinking of changing to ALSA one day...). ALSA is much easier to configure and supports more soundcards and is posibly better in sound quality than OSS, and: you don't need SMixer, as it includes alsa-mixer or amixer with which you'll set the right volumes once and then type "alsactl store". Configure sTaLMP3Box to load "alsactl restore" on startup and you'll always have the right volumes!
Regarding this issue, I can't give you many details, as this goes behind the scope of this document. I recommend you reading the usual docs. But some hints I can give you: De-install all not needed stuff and de-activate all scripts/programs which would load at bootup and which are not absolutely needed! All this is very important for improving stability and performance, especially on older PCs like Pentium 100 or similar! And, of course, like that, you'll get more free space on the hard disk (obviously this doesn't count if you got some dozens of giga bytes in there, but I suppose that's not the normal case, isn't it?). And very important: configure your system very well and carefully, so there are no issues with stability or performance which could negatively influence sTaLMP3Box!
A hint for the "perfectionists" of you out there: compile your own Kernel on the target machine with only the needed stuff, as this will increase performance! (I didn't do it (yet...)) ;-)
The configuration isn't much work, as most things already have been done if you followed the instructions in the previous section.
But here we go:
After having launched sTaLMP3Box for the first time in a specific directory (in this case Root "/"), it will have created a new file, called ".stalmp3boxrc" (as it has a dot in the name you'll have to do "ls -all" to see the file listed ;-). Open that file with your favorite text editor. It should look like this:
The file format is pretty easy. After the setting name there comes a space and then a "=" and then another space followed by the value. The order of the settings has to be exactly like after starting sTaLMP3Box for the first time.
SetVolume = 0
DelayValue = 3500
Mount_Cmd = /bin/mount
OGG_support = 1
MPG_support = 1
Changing_Delay = 2000
Now, if you want to have a Mixer program run each time after starting sTaLMP3Box, then set "SetVolume" to 1 (has to look like this: "SetVolume = 1").
Then you'll also have to put the command with which the Mixer is called as the value of "VolCmd" (witht complete path to the mixer program). If you don't want a mixer to be run, let both settings unchanged.
The third setting is a Delay, which is very important on very fast machines, as there the timing of the LCD Control could be too fast and it wouldn't work. On the other hand, a too slow timing would give bad results on slower machines. So I made it possible to be changed. I've had good results with values between 2500 and 3500 on normal computers (Pentium 100 until K6). But if you have some Athlon or similar in there (that would be pretty anormal, but I don't mind ;)), then set the value to above 5000.
The fourth and fifth settings are for giving you the chance to install up to two more harddrives in the jukebox-computer where you can put songs on, and if you add their mount-points to these settings, sTaLMP3Box will recognize them and show the Disc Usage statistics about them, too, when pressing the "8" key.
The sixth setting is self-explaining, isn't it? You'll have to put there the mount-point of your CD-ROM Drive.
The seventh setting is analogue to this: put there the mount-point of your floppy drive (normally you need the floppy drive only if you intend to make updates of sTaLMP3Box or other software from time to time, without having to connect a monitor to the system (because if sTaLMP3Box recognizes the floppy, then you can use its filemanager to make the updates).
The eighth setting is important, too: you define there what the Mount-Command on your system is. Now, normally this is "/bin/mount". But do you remember my Mount2-Script? Yes, right, it permits you using CDSpeed before every Mount to decrease your CD-ROM's speed and noise, and that's why I have this Mount-Command setting: put here the command to run the Mount2-Script and it'll use this script for every Mount, instead of the normal Mount. But, attention! Mount2-Script has to be correctly configured! See above in the installation section.
The ninth setting has to be set to "1" if you want to be able to play OGG/Vorbis files. In this case you'll have to install all the needed OGG/Vorbis tools, otherwise there will be errors! If you don't want to play OGG/Vorbis, set it to "0".
The tenth setting is the same, but for MP3 files support. Set it to "1" if you want to play MP3s. If you don't want to play MP3s then set it to "0". You need MPG123 or MPG321 installed correctly if you set it to "1", otherwise there will be errors!.
The last setting is a delay value in milliseconds that is waited when changing between playing a MP3 and a OGG/Vorbis or vice-versa. It means, that when it was playing a MP3 and the next file in the playlist is a OGG/Vorbis, then it has to exit MPG123 and start OGG123, and between those two actions there needs to be a pause to ensure that the audio device is freed and the other program can be started. The same occurs when doing the opposite: Changing from playing a OGG/Vorbis to a MP3. On fast machines this value can be set to "1000" (1 second). But on slower machines it needs to be "2000" or even "3000". Try the best value for your case, you'll see if it works or not (You see that it doesn't work when there appears some error message from MPG123 or OGG123 saying that it can't open the audio device.)
All those settings in the ".stalmp3boxrc"-file can also be changed when running sTaLMP3Box, so you don't need a monitor and a text editor to change them. It is the key "s" which invokes the settings editor in sTaLMP3Box. Now we're all done! Test the whole thing rebooting the target computer after making sure that you've really done everything! After reboot, it should start normally Linux, and when getting to the point where it starts the bootup scripts, it will, at some point, start sTaLMP3Box. If it doesn't, then check the error messages, and if it says something like "command not found" then check the "s20stalmp3box"-file in the /etc/rcX.d/ directory (replace X with the runlevel you're using. Check also that you've put the file in the right directory, I mean, make sure it's really that runlevel you're using!) if the path to stalmp3box is correct. It should work now after correcting it if it was wrong (reboot to see if it works). If the error message on boot is "permission denied" or similar, then you'll have to do a "chmod +x" to the "s20stalmp3box"-file, that's the most common error. If it's a different problem and you're unable to solve it, then send me a complete report. Now, I suppose you got it working and sTaLMP3Box started. Check the Output of it, if it is like showed above when we were Testing it. It should not say any error messages. If it does, then here are some possibilities:
"name_of_the_mixer_you_want_to_be_run: file or command not found": this means that the Mixer program you wanted to be run at start couldn't be found. Check ".stalmp3boxrc".
"mpg123: file or command not found": it couldn't find MPG123. Check your installation!
If MPG123 outputs some error messages then you might have installed a very old version of it now supporting some command line keys. Check that you have 0.59r or later!
If MPG123 or OGG123 gives you a error about problems opening the audio device, then you probably have to increase the changing-delay value in the ".stalmp3boxrc"-file.
If on start of sTaLMP3Box appear strange errors about converting illegal string to integer or similar for the delay or other setting or in any similar case, then you have some error in the ".stalmp3boxrc"-file. Check it!
If there are other error messages, then send me a report, please. I'll from time to time add new error messages that are "discovered" to this page. So, if everything went well, check if the LCD display has correct output (see above under "Testing"). If all this works, then continue with testing the functions of sTaLMP3Box: Do the same procedure like when we were testing it (see above) and check if you can add a song to the playlist and play it. If yes, then continue. If not, check installation of mpg123 and everything, like described above. Now, test more: mount a CD, eject a CD, navigate through all directories on disc and CD, etc, edit the playlist moving things around and removing songs, etc, test file operations in the file manager, look if the ID3-Tag info and the OGG/Vorbis info works and if Disc Usage Info is correct and everything, resuming: Test ALL functions! If Mounting of a CD doesn't work, the error is certainly or in the ".stalmp3boxrc"-file or in the Mount2-Script! Check all paths! If you have other problems, drop me a line per e-mail.
Did everything work? If yes, then, congratulations! You've made it!!!! :-)) Enjoy using you new MP3 JukeBox and send me a nice post card or something ;)) (at least send me an e-mail letting me know if it worked and the problems you had, that's very important for further development of sTaLMP3Box!!)
(learn these commands or, which is much better, put small stickers on those keys on the keyboard and write the corresponding command on them, as like that the confort of using sTaLMP3Box will be much greater! And everyone will be able to learn using your JukeBox!) Now, here are some fundamentally important indications about the control of sTaLMP3Box: After starting sTaLMP3Box, you have to press the "p"-key first before doing anything else. That's because almost no function works correctly without having first been in the playlist mode after program start. Then, when you're in the playlist mode, you'll have to imagine the whole menu system as being based on the playlist mode, I mean, when you press "f" for the filedialog, for instance, do something in the filedialog and when you finished, then you press "Esc", you'll get back to the playlist mode, which is the lowest level actually. Another "Esc" will do nothing, because there's no lower level than the playlist. The same happens with all other modes and functions that work "outside" the playlist, even if you go to another mode again, for example, you're in the filedialog and then you press the button to rename a file, if you now press "Esc" once, you will get back to the filedialog, and pressing it again you'll get to the playlist. Knowing that, you'll have no problem in learning to control stalmp3box.
What it does
left arrow, right arrow
up arrow, down arrow
invokes the playlist
add selected song files to playlist (only works when in the filedialog)
remove songs from playlist
add all song files in actual directory to the playlist (only works when in the filedialog)
add all songs on the whole CD to playlist (may take a minute or two. If it gets completely stuck due to a read error or so, try hitting the emergency key (0) ) (can be used at any point, no need for the filedialog)
select (mark) (press several times to select different items (songs or files, works in playlist and filedialog) and to unselect)
start move mode (after that, you'll be able to move selected songs up and down with the cursor keys. When you're finished, press "insert" again. Only works in Playlist.)
mark group or mark all (press space after having selected one the first item with "m" and it will select all items until the first line of the diplay at the moment you pressed "space". Or press "space" when not having selected anything, and it will select all items. Works in playlist and filedialog).
scroll up 10 lines
scroll down 10 lines
up to higher directory (like "cd ..") (works only in filedialog)
invokes the incorporated file manager (filedialog) (to let you choose songs to add and to do basic file operations)
change into directory (the one on the first display line, works only in filedialog)
Emergency Key: Cancel all running subprocesses, use only when something got blocked (i.e. read error on CD) or when experienced a crash (shouldn't happen often, but if it does, try this key) -- Warning: you may experience a full crash (very rare, but happens sometimes) when using this key, so don't do it "for just playing around", just use it when you need it!
copy files/dirs (only works in the filemanager, copies the selected files/dirs, will ask you to go to the destination directory and then you must press key "3" again to actually copy the files.)
move files/dirs (only works in the filemanager, works exactly like the copy function)
rename file/dir (only works in the filemanager)
delete files/dirs (only works in the filemanager)
make directory (only works in the filemanager)
show disk usage info (to get back to the playlist, press, like always in such cases, the "Esc"-key. If you press "8" while you're playing a song and quiet mode is off, the program will automatically switch to quiet mode and then, one second later, display the disk usage info)
Switches Random Mode on or off. While random mode is on, after the end of a song or when pressing the "next" and "previous" song keys, stalmp3box will play a song that it selects randomly, and no song will be repeated. But if you switch it on again after having switched off, it will ask you if you want to "start a new set". If you select yes, then he forgets about what songs had already been played, so you actually will have songs repeated (only when comparing to the playing BEFORE switching Random off). If you choose No, then he'll remember what had already been played, and simply continues as if you had never switched Random off. When every song in playlist has been played once, then Random Mode is switched off automatically and he continues by playing the first song in the playlist. (If you press this key while you're playing a song and quiet mode is off, the program will automatically switch to quiet mode, show you the state of random, and some seconds later, the display will return to verbose playmode like before)
exit/cancel actual function or get back to "lower level" (use this key always to cancel or to exit some mode/function/menu, etc. and to get back to the previous mode)
save playlist as a file (only works in playlist)
open a playlist which was saved as a file by the "e" key. (only works in playlist, will invoke automatically the filedialog, then you'll have to scroll so that the file to open appears in the first line of the display and press "o" again to load the playlist from that file. If you press this key while you're playing a song and quiet mode is off, the program will automatically switch to quiet mode and then, one second later, display the file dialog to let you open a playlist))
shows ID3-Tag or Vorbis-Info for the actual song, depending on if it's a MP3 or a OGG/Vorbis file. (for the song in the first line of the LCD, press "Esc" to get back to the playlist. If you press this key while you're playing a song and quiet mode is off, the program will automatically switch to quiet mode and then, one second later, display the ID3-Tag.)
invokes the settings editor (if you press it by mistake and don't want to change anything, just say "n" (NO) always when he asks for every option if you want to change it.
plays actual song (the song in the first line of the LCD, only works in playlist.)
pause playing (only works in playlist.)
stop playing (only works in playlist.)
rewind 2 seconds (only works in playlist.)
forward 2 seconds (only works in playlist.)
play previous song (only works in playlist. If Random mode is on, it'll play another song, chosen randomly)
play next song (only works in playlist. If Random mode is on, it'll play another song, chosen randomly)
quiet or verbose play mode (press it repeatedly to toggle between the two modes, this takes one or two seconds to get from the verbose play mode (scrolling display) to the quiet mode (showing the playlist usually)).)
shows this help (not so detailed ;-)
quits the program and shuts down the PC (if you want that) -- important: wait until Linux has shutdown completely before switching off the power! Don't rely on the message "Now you can switch it off", if at this point the harddisk is still being accessed, don't switch off yet! Wait until nothing happens anymore. Then you can power off. (I am thinking in building some day an electronic device which switches it off automatically after shutdown...)
UPDATE: From version 0.9.4 on, you can change the mapping of the control-keys for sTaLMP3Box, by editing the file "keymap". This means, that you can define your own control keys instead of the keys listed above. Here are some hints how to edit the file keymap: Its format is pretty simple: in one line you have the name of the control function and in the next line you have the associated key. The key is indicated in two different formats:
EOF ---> 31.12.2002: Important Notice! This page is ALMOST finished. So it is very close to the final version. But there may be still errors and missing stuff and so. Therefore, visit sTaLMP3Box Site regularly and you'll see on the News-Page if any changes have been made to this Installation and Configuration Page.