The Linux MP3-HOWTO

By Phil Kerr, phil@plus24.com

v1.61, 2001-12-16


This document describes the hardware, software and procedures needed to encode, play, mix and stream MP3 sound files under Linux.

1. Introduction.

2. Copyright of this document.

3. Where to get this document.

4. Acknowledgments.

5. Disclaimer.

6. Hardware Requirements & Performance Issues.

7. Software Requirements.

8. Setting up your system.

9. Encoding from Audio.

10. Encoding from CD-ROM.

11. Streaming MP3's.

12. Listening to MP3's.

13. ID3 Editing.

14. MP3 to Minidisc.

15. Feedback.


1. Introduction.

This document describes the hardware, software and procedures needed to encode, play, mix and stream MP3 sound files under Linux.

It covers:


2. Copyright of this document.

This HOWTO is copyrighted 1999, 2000 Phil Kerr.

This document is distributed under the terms of the GNU Free Documentation License. You should have received a copy along with it. If not, it is available from http://www.fsf.org/licenses/fdl.html.


3. Where to get this document.

The official version of this document can be obtained from the Linux Documentation Project http://www.linuxdoc.org/.

The homepage for the most recent version of this HOWTO is: http://www.mp3-howto.com

3.1 Translations

This HOWTO has been translated into the following languages:

Please note that translations may be slightly out of date from this document as, naturally enough, the translations take time.

Korean

http://kldp.org/HOWTO/MP3-HOWTO By Lee,So-min <animator@nownuri.net>

French

http://www.freenix.org/unix/linux/HOWTO/MP3-HOWTO.html By Arnaud Gomes-do-Vale <arnaud@carrosse.frmug.org>

Hungarian

http://free.netlap.hu/howto/MP3-HOGYAN.html By Andras Timar <atimar@itp.hu>

Italian

ftp://ftp.pluto.linux.it/pub/pluto/ildp/HOWTO/MP3-HOWTO By Mariani Dario <darkpand@uni.net>

Spanish

http://www.insflug.org/documentos/MP3-Como By Arielo <larocka@yahoo.com>

Dutch

http://nl.linux.org/doc/HOWTO/MP3-HOWTO-NL.html By Reggy Ekkebus <reggy@zeelandnet.nl>

Japanese

http://www.linux.or.jp/JF/JFdocs/MP3-HOWTO.html By Saito Kan <can-s@geocities.co.jp>

Slovene

http://www.lugos.si/delo/slo/HOWTO-sl/MP3-HOWTO-sl.html By Jernej Kovacic <jkovacic@email.si>

Many thanks to the above translators. If you can translate this HOWTO, please drop the author an email. Also please state the URL where the translation will be housed.


4. Acknowledgments.

In writing this HOWTO I have had to draw heavily on the Sound-HOWTO By Jeff Tranter, and the Sound-Playing-HOWTO By Yoo C. Chung.

Thanks also to the other HOWTO authors whose works I have referenced:

Linux System Administrators Guide By Lars Wirzenius.

Linux Network Administrators Guide By Olaf Kirch.

Multi Disk System Tuning HOWTO By Stein Gjoen.

Also a big thank-you to all who have sent in feedback, comments and bug-reports.


5. Disclaimer.

Use the information in this document at your own risk.

I disavow any potential liability for the contents of this document.

Use of the concepts, examples, and/or other content of this document is entirely at your own risk.

All copyrights are owned by their owners, unless specifically noted otherwise.

Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.

Naming of particular products or brands should not be seen as endorsements.

You are strongly recommended to take a backup of your system before major installation and backups at regular intervals.


6. Hardware Requirements & Performance Issues.

Digital Audio processing is a resource intensive task that relies heavily on the processing and I/O capabilities of a system. I would strongly recommend a Pentium class machine as a minimum.

If you are going to be encoding from an analogue audio source via the line or microphone input, a PCI soundcard will give the best results. The I/O performance difference between an ISA and PCI based card is significant, over 132 MBytes/sec for PCI (quote taken from the PCI-HOWTO). Naturally, the better the quality of the soundcard in terms of its signal-to-noise ratio, the better the encoded MP3. I've been using the Soundblaster PCI128 and just switched over to a Soundblaster Live Value; both cards give good audio performance, but the Live has significantly better S/N ratios, good enough for semi-pro audio work. Remember the old data processing maxim:- garbage in - garbage out!

Creative have a Beta driver for the Soundblaster Live! which can be downloaded from:

http://developer.soundblaster.com/linux/

When recording analogue audio to a hard disk, more commonly referred to as direct to disk or d2d recording, the performance of the disk, and its interface is critical. If you are using an IDE based based system, mode 4 or UDMA is preferable as the transfer rate is sufficiently high enough to provide reliable data transfer without problems.

The ideal solution would be to use a SCSI based system as the drives and interface have far better throughput capabilities, a sustained 5MB/sec for SCSI 1 through to 40-80MB/sec for ultra-ultra2/wide SCSI. IDE can peak at anything from 8.3 MB/s to 66 MB/s for Ultra DMA mode 4 but these speeds are peak, average transfer rates will be slower. If you can find, or afford, an AV SCSI drive, go for it. AV drives have had the read/write head system optimised for continuous data transference; other SCSI and IDE drives normally cannot sustain continuous data transfer as the write head heats up!

Naturally a drive that has cache will give more consistent results than one that doesn't, as the cache will act as a buffer if the heads do lift or it cannot handle the throughput.

If your drive isn't up to spec, your recording will suffer from dropouts and glitches, where the drive failed to record the signal. If you are recording one-off events, such as live performances invest in a good SCSI based disk system.

Another cause of d2d dropouts is a heavily loaded system. Background tasks can cause the system to momentarily glitch. Its recommended to run as few background services as you can, especially networked based services. For more information about setting network services, and startup scripts please refer to the SAG and NAG guides.

Virtual memory paging will also cause glitches, so run with as much physical RAM as you can, I'd recommend at least 32 Mb, but you may well need more.

For those wanting to extract the most out of their system, optimising the kernel probably wouldn't do any harm either.

For streaming MP3's the better the network card the better the throughput, naturally a 100Mb interface will give better throughput than a 10Mb interface :)

While the hardware specifications above will give you a decent system to encode audio data, don't discount using older, lower spec kit if that's all you have access to.

It'll be a good challenge for a sys-admin to tweak a low-spec system to give good results, and the end result will probably be a happier Linux box.

Another important issue is the audio cabling. Cheap, poor quality cables and connectors will result in poor recording quality. If your soundcard has the option to use phono, sometimes referred to as RCA connectors, use them. Gold plated contacts will also help maintain audio quality, as will keeping audio cables away from data cables as there will be a chance of interference between them.

But don't forget, spending a fortune on the best audio cabling will be lost if the rest of the system hasn't been optimised.

For encoding MP3's from CD-ROM, the speed or type of drive will determine the time taken to read the raw information from it. A single speed drive will probably be too slow for all but the most patient.

Your CD-ROM must be connected to your soundcard if you want to hear what you are recording, either using the internal connector or by connecting headphone's to the headphone output, although you will not be able to listen to MP3's through the CD-ROM headphone socket!

For detailed instructions on setting up soundcards, now would be an excellent time to read the Sound-HOWTO.


7. Software Requirements.

Converting audio to MP3's is normally a 2 stage process, first the audio is recorded into a WAV format, then the WAV is then converted into an MP3. Some utilities will do both processes in one go for you.

The format you wish to encode audio from, CD or direct audio, will determine what software tools you need to produce the WAV file.

If you are wanting to encode from audio input, you will need a program that will record from your soundcard's input and save the results in a WAV format. Below are some useful utilities (most of the comments are taken from the respective website of the app.)

7.1 Rippers & WAV Recorders

To grab from analog audio line-in. Wavrec

Wavrec is distributed as part of wavplay, which can be downloaded from:-

ftp://sunsite.unc.edu/pub/Linux/apps/sound/players/

To convert CD audio data to WAV format, sometimes known as CD ripping:

CDDA2WAV

http://metalab.unc.edu/pub/Linux/apps/sound/cdrom/

Cdparanoia

Cdparanoia is a Compact Disc Digital Audio (CDDA) extraction tool, commonly known on the net as a 'ripper'. The application is built on top of the Paranoia library, which is doing the real work (the Paranoia source is included in the cdparanoia source distribution). Like the original cdda2wav, cdparanoia package reads audio from the CDROM directly as data, with no analog step between, and writes the data to a file or pipe in WAV, AIFC or raw 16 bit linear PCM. Compared to cdda2wav, it's much slower but really gets the best results you can get even from CDs that are difficult to rip for scratches or other read-errors.

http://www.xiph.org/paranoia/index.html

RipEnc

RipEnc is a bourne shell script frontend to Cdparanoia, cdda2wav, tosha and Bladeenc, 8hz-mp3, l3enc. It utilizes CDDB lookups to automate the naming of songs as they are ripped. A manual naming option is also available. The entire CD can be ripped or you can pick the songs to rip. ID3 tags are also supported.

http://www.asde.com/~mjparme/index.htm

Cd2mp3

cd2mp3 is a freeware software, designed to handle 2 other programs cdda2wav(that rips the tracks from cd) and lame (that encodes the mp3s)

http://sertaozinho.org/cd2mp3/index.html

RipperX

RipperX is a GTK program to rip CD audio and encode mp3s. It has plugins for cdparanoia, BladeEnc, Lame Mp3 encoder, XingMp3enc, 8hz-mp3 and the ISO v2 encoder. It also has support for CDDB and ID3 tags.

http://www.digitallabyrinth.com/linux/ripperX/

Grip

Grip is a GTK-based CD-player and CD-ripper/MP3-encoder. It has the ripping capabilities of cdparanoia built in, but can also use external rippers (such as cdda2wav). It also provides an automated frontend for MP3 encoders, letting you take a disc and transform it easily straight into MP3s. The CDDB protocol is supported for retrieving track information from disc database servers. Grip works with DigitalDJ to provide a unified "computerized" version of your music collection.

http://www.nostatic.org/grip/

7.2 Encoders

To convert the WAV file to MP3 format you will need an encoder:

Blade's MP3 Encoder

BladeEnc is a freeware MP3 encoder. It is based on the same ISO compression routines as mpegEnc, so you can expect roughly the same, or better, quality . The main difference is the appearance and speed. BladeEnc doesn't have a nice, user-friendly interface like mpegEnc, but it is more than three times faster, and it works with several popular front-end graphical user interfaces.

http://bladeenc.cjb.net

Lame

In the great history of GNU naming, LAME stands for LAME Ain't an Mp3 Encoder. LAME is not an mp3 encoder. It is a GPL'd patch against the dist10 ISO demonstration source. LAME is totally incapable of producing an mp3 stream. It is incapable of even being compiled by itself. You need the ISO source for this software to work. The ISO demonstration source is also freely available, but any commercial use (including distributing free encoders) may require a license agreement from FhG (Fraunhofer Gesellschaft, Germany).

http://www.sulaco.org/mp3/

Gogo

This is a very fast MP3 encoder for x86-CPU, which is based on LAME ver 3.29beta and optimized by PEN@MarineCat, Keiichi SAKAI, URURI, kei and shigeo. (You will also need to download NASM to compile the source, which can be found http://www.web-sites.co.uk/nasm/)

http://homepage1.nifty.com/herumi/gogo_e.html

7.3 Players

To play the MP3's you will naturally need a player:

Xmms (Formerly known as X11Amp)

This player has most of the features as Winamp from Windows 95/98/NT but it will of course feature some specials only available for the Linux version.

http://www.xmms.org

Xaudio

Xaudio is a very fast and very robust multi platform solution for Digital Audio playback, especially targeted at MPEG Audio (MP1, MP2 and MP3) decoding.

http://www.xaudio.com

AlsaPlayer

AlsaPlayer is a new type of PCM player. It is heavily multi-threaded and tries to exercise the ALSA library and driver quite a bit. It has some very interesting features unique to Linux/Unix players. The goal is to create a fully pluggable framework for playback of all sorts of media with the focus on PCM audio data. Full speed (pitch) control, positive *and* negative! First Linux- and only GPL player that does this!! MP3's and CD's do varispeed :)

http://www.alsa-project.org/~andy/

mpg123

What is mpg123? It is a fast, free and portable MPEG audio player for Unix. It supports MPEG 1.0/2.0 layers 1, 2 and 3 (those famous "mp3" files), and it has been tested on a wide variety of platforms, including Linux, FreeBSD, NetBSD, SunOS, Solaris, IRIX, HP-UX and others. For full CD quality playback (44 kHz, 16 bit, stereo) a Pentium (or fast 486), SPARCstation10, DEC Alpha or similar CPU is required. Mono and/or reduced quality playback (22 kHz or 11 kHz) is even possible on slower 486 CPUs.

http://www.mpg123.org

Freeamp

FreeAmp is an extensible, cross-platform audio player. It features an optimized version of the GPLed Xing MPEG decoder which makes it one of the fastest and best sounding players available. FreeAmp provides a number of the most common features users have come to expect in a clean, easy to use interface.

http://www.freeamp.org/

7.4 Streaming Servers

Streaming servers allow you to 'broadcast' MP3's across a network, whether this is your intranet or the internet itself.

Icecast

Welcome! Icecast is a Mpeg Layer III Audio broadcasting system brought to you by the linuxpower.org team. Icecast comes bundled with iceplay, and icedir. Iceplay is a playlist streamer that will allow you to send pre-encoded files to your Icecast server.

http://www.icecast.org/

Fluid

Fluid Streaming Server is a program for streaming media over networks and in its current form using the mp3 format.

http://www.subside.com/fluid/ (old site)

http://fluid.sourceforge.net/ (new site)

Litestream

Litestream is an Open Source, infinitely scalable high-capacity MP3 streaming system for Unix.

http://www.litestream.net/

Apache::MP3

Module for streaming MP3's using the Apache WebServer.

This module takes a hierarchy of directories containing MP3 files and presents it as a browsable song library for streaming over the web.

[Available from CPAN]

7.5 Mixing

LiveIce

LiveIce is the source client for Icecast which encodes an mpeg stream for broadcast as it is created. Unlike clients such as Shout and IceDJ this permits the broadcast of live audio, rather than prerecorded mp3's.

LiveIce is bundled with Icecast, newer versions together with documentation may be found at the website below:

http://star.arm.ac.uk/~spm/software/liveice.html

eMixer

eMixer is an easy-to-use front-end to mpg123 that allows you to play and mix two mp3 streams together. The ability to mix two mp3s makes eMixer act like a cross-fader, effectively giving the user DJ-like capabilities from the computer console. eMixer is also very able in a "real time" party environment. eMixer is based on the original mp3 mixing code upon which liveice's mixing component is built.

http://emixer.linuxave.net/

GDAM

GDAM is real-time digital dj mixing software package. Any number of mp3 files can be played and mixed simultaneously. Effects can be added, changed, and rearranged dynamically. GDAM features a client-server architecture; all sound is produced by a server, which receives instructions from any number of clients. Other features include plugins for audio effects and interface components, caching and looping, sequencing, assisted beatmatching, a waveform viewer/beat calculator, contiguous queuing (no pauses between songs when using a playlist), an online help system, an mpg123 clone which runs on a gdam server, flexible command line interface for direct control of server, recording of entire mix or any point in stream to buffer/disk/mp3 encoder, support for multiple sound devices, and support for midi hardware control.

http://gdam.org/

alternative:

http://gdam.sourceforge.net

7.6 ID3 Editors

id3ed

id3ed is an ID3 tag editor for mp3 files. You can set tags interactively or from the command line, or a combination of both. id3ed can set genre by name or number. You can also remove or view tags.

http://www.azstarnet.com/~donut/programs/id3ed.html

mp3info

MP3info is a small utility for reading and writing MPEG Layer 3 (MP3) ID3 tags. Console (command-line and interactive ncurses) and GTK versions are included.

http://metalab.unc.edu/mp3info/

7.7 Stream Grabbers

Streamripper

Streamripper records shoutcast streams. If the stream contains track info (meta data), streamripper creates a separate file for each track.

http://streamripper.sourceforge.net/

Wget

GNU Wget is a freely available network utility to retrieve files from the World Wide Web using HTTP and FTP, the two most widely used Internet protocols. It works non-interactively, thus enabling work in the background, after having logged off.

Wget is far more than a stream grabber!

ftp://ftp.gnu.org/gnu/wget/

7.8 Misc

Volume Normalization

Wavnorm

If you have encoded live audio, or have encoded from older cd's you may find variations in the overall sound level.

To change the encoded volume levels of the MP3's you will need to normalise them using wavnorm.

http://www.zog.net.au/computers/wavnorm/

SOX

Sox is a very handy sound conversion utility which I'd recommend having, and you will need it if you wish to use wavnorm.

ftp://sunsite.unc.edu/pub/Linux/apps/sound/convert/

You may also need a mixer program; Xmixer works well and is included with most distributions.


8. Setting up your system.

This section will describe the basics of setting up your Linux system to record audio from either an analogue or CD-ROM source.

I'm basing this section around my Intel based Linux system which is running Redhat, but should be reasonably distribution neutral. If you have any success in using this HOWTO on other hardware, please get in touch.

Naturally a reasonable prerequisite is a working soundcard. At this point in the HOWTO, I invite you to read the excellent Linux Sound HOWTO, by Jeff Tranter. After which a good read of the Linux Sound Playing HOWTO, by Yoo C. Chung. Both of the above mentioned HOWTO's cover the details of getting a sound system working under Linux far better than I could.

8.1 Setting up for Analogue Audio Capture

Firstly, set up your audio. There are a multitude of ways to route audio before it gets to your Linux box, some common ones are:

Line out to Soundcard Line in. Most audio devices have a Line output sockets. Line level is a standard that specifies what voltage the audio device will send out. If I remember correctly it is 500mV for domestic and Semi Pro devices, and 750mV for Pro audio devices. I would guess that the standard set for most soundcards will be 500mV, but some of the newer Pro audio may be to the higher standard It shouldn't make too much difference unless you are recording at very high levels.

The Line level output is normally used to connect HI-FI equipment to an amplifier, so things such as Tape Decks, Radio Tuners, CD players, DAT machines and Mini-Disc players should connect without problem. Turntables can be more of a problem, see below for more information.

You could capture audio from VCR's as well. Most VCR's will either have Line out for sound, or you can Get a Line out from a SCART socket if your VCR has one.

Amplifier Tape out to Soundcard Line in, Soundcard Line out to Amplifier Tape in. This configuration is essentially replacing a traditional tape recorder connected to your HI-FI amplifier with your Linux system. The Soundcard Line out to Tape in allows monitoring of the recording levels.

Mike to Soundcard Mike in. The voltages generated by microphones is very much smaller than those used in Line level devices. If you were to plug a Microphone into the Soundcard Line in, chances are you would never record anything.

WARNING, doing the reverse, plugging a Line level device into the Soundcards Microphone input, can damage your soundcard!!

Turntable to Mike in.

Many thanks to Mark Tranchant for the following.

The raw output from a record deck cartridge is very low level. However, you cannot plug it directly into a microphone input and expect good results. The output requires equalization, as records are mastered with less bass and more treble to optimize the physics of the moving needle. This equalization is carefully defined and referred to as RIAA equalization. You *need* to run the output through a phono preamp first, and then into a line input.

Music keyboards & synths should be connected to the Soundcards Line in, with guitars connecting to Line in via a DI (Direct Injection, used to convert the signal to Line level) box.

Before you plug in anything into your soundcard, make sure the volume levels are turned down to minimum, or if using microphones they are either turned off or away from speakers.

8.2 Setting up for CD-ROM Audio Capture

Setting up your Linux system to extract audio data from CD-ROM is reasonably straight forward.

If you can hear a track playing from your CD-ROM through your speakers or amplifier, connected to your soundcard, then there's a reasonable chance you should be able to record from it.

8.3 Additional Setting up

Log in as per normal to your system, then using a mixer program set the recording levels that are loud enough to give you a decent recording level, but aren't too loud and distorting. I normally just judge this by ear, after a while you'll get to know what levels are best for your kit.

I recommend either turning off all unnecessary services or switching to the single user runlevel, especially when encoding from an audio source. This is to ensure that the bare minimum of services are running and thus minimising system glitches when recording.

I've set up a separate SCSI drive, exclusively to record the audio to, which I'll refer to as /mp3. I've done this mainly for the performance gains in using a SCSI drive. Also, recording onto a dedicated drive, where you are almost certain the head isn't going to suddenly skip to another part of the drive as you are writing audio data to it, is a good thing :)

For details on setting up a Linux system with multiple disk drives, a good read of the Multi-Disk-HOWTO, by Stein Gjoen may be useful.


9. Encoding from Audio.

Firstly, make sure you have enough space on your drive. At CD quality, 44.1 Khz 16 Bit stereo, 1 minute takes nearly 10 Mb (5 MB per channel).

I normally record at DAT quality, which is 48 Khz 16 Bit stereo.

Using wavrec I use the following syntax:


[dj@megajukebox]$ /usr/local/bin/wavrec -t 60 -s 48000 -S /mp3/temp.wav

The first part is an explicit path to wavrec. The '-t 60' specifies the length of time to record for, in seconds.

The third option, -s 48000 refers to the sample rate in samples/sec. (48000 is the rate for DAT, 44100 is CD)

The last option is the path to the output file.

To see the full set of options, run waverec -help, or see it's man page.

This will produce your WAV file Next you will need to encode it into MP3 format.

Use bladdenc with the following command line.


[dj@megajukebox]$ /usr/local/bin/bladeenc <em/[source file] [destination file]/ -br 256000

The -br option sets the bit rate, in this case I've set the rate to the maximum rate of 256k bits/s. The path to bladeenc may also be different on your system to the one I've used in my example.

To see the full set of options, run bladeenc -help, actually this is an invalid option, but will display the list of options.

The same encoding using Lame (as well as Gogo as it is based on Lame) would need the command line


[dj@megajukebox]$ /usr/local/bin/lame <em/[source file] [destination file]/ -b 256


10. Encoding from CD-ROM.

In a similar way to encoding from audio, encoding from CD is a 2 stage process. Firstly the audio data is extracted from the cd and converted into a wav file. Then the wav file is converted into MP3.

There are basically 2 types of encoders, console based and X based. Both do the same job, but the X based are easier to use (and look nicer).

Again, before you start to encode, check you will have enough drive space on your system.

10.1 Command Line encoding

I've written a very simple Perl script that will rip and encode tracks from a CD.


#!/usr/bin/perl

if ($ARGV[0] ne "") {

$count = 1;

do {
 
$cdcap = system("cdparanoia", $count, "/mp3/cdda.wav");
$track = "$ARGV[1]/track".$count.".mp3";
$enc = system("bladeenc  /mp3/cdda.wav $track -br 256000");
$count++;

}
until $count > $ARGV[0];
exit;
}

else {
print "Usage cdriper [no of tracks] [destination directory]\n\n";
}

Please note: The above script is very basic and has nothing fancy, like error checking or CDDB. Improve at your leisure :)

The main lines of interest are:


$cdcap = system("cdparanoia", $count, "/mp3/cdda.wav");

This line calls the CD ripper, cdparanoia. Cdparanoia converts raw CD audio data to WAV format.

I'm using Cdparanoia, but if you wish to use CDDA2WAV, the command line would be:


$cdcap = system("cdda2wav", $count, "/mp3/cdda.wav");

The salient options are $count, which is the number of tracks to rip, and then the path for the outputted WAV file. In my example this will go to a tmp directory on my MP3 SCSI drive.

The WAV file is then converted into a MP3 file using Bladeenc.

I've written this Perl script in order to rip a CD without having to rip and encode each track, and without having to use the batch mode of Cdparanoia. This cuts down on free disk space needed as Cdparanoia's batch mode will rip the whole disk, and take up anything upto 600 Meg.

If you wanted to use Lame or Gogo, replace the encoder line with:


$enc = system("lame  /mp3/cdda.wav $track -b 256");

or
$enc = system("gogo  /mp3/cdda.wav $track -b 256");

Here is a dump of the available option for each of the encoders.

Bladeenc


BladeEnc 0.91    (c) Tord Jansson          Homepage: http://bladeenc.mp3.no
===============================================================================
BladeEnc is free software, distributed under the Lesser General Public License.
See the file COPYING, BladeEnc's homepage or www.fsf.org for more details.

Usage: bladeenc [global switches] input1 [output1 [switches]] input2 ...

General switches:
  -[kbit], -br [kbit]  Set MP3 bitrate. Default is 128 (64 for mono output).
  -crc                 Include checksum data in MP3 file.
  -delete, -del        Delete sample after successful encoding.
  -private, -p         Set the private-flag in the output file.
  -copyright, -c       Set the copyright-flag in the output file.
  -copy                Clears the original-flag in the output file.
  -mono, -dm           Produce mono MP3 files by combining stereo channels.
  -leftmono, -lm       Produce mono MP3 files from left stereo channel only.
  -rightmono, -rm      Produce mono MP3 files from right stereo channel only.
  -swap                Swap left and right stereo channels.
  -rawfreq=[freq]      Specify frequency for RAW samples. Default is 44100.
  -rawbits=[bits]      Specify bits per channel for RAW samples. Default is 16.
  -rawmono             Specifies that RAW samples are in mono, not stereo.
  -rawstereo           Specifies that RAW samples are in stereo (default).
  -rawsigned           Specifies that RAW samples are signed (default).
  -rawunsigned         Specifies that RAW samples are unsigned.
  -rawbyteorder=[order]Specifies byteorder for RAW samples, LITTLE or BIG.
  -rawchannels=[1/2]   Specifies number of channels for RAW samples. Does
                       the same as -rawmono and -rawstereo respectively.

Global only switches:
  -quit, -q            Quit without waiting for keypress when finished.
  -outdir=[dir]        Save MP3 files in specified directory.
  -quiet               Disable screen output.
  -nocfg               Don't take settings from the config-file.
  -prio=[prio]         Sets the task priority for BladeEnc. Valid settings are
                       HIGHEST, HIGHER, NORMAL, LOWER, LOWEST(default) and IDLE
  -refresh=[rate]      Refresh rate for progress indicator. 1=fastest, 2=def.
  -progress=[0-8]      Which progress indicator to use. 0=Off, 1=Default.

Input/output files can be replaced with STDIN and STDOUT respectively.

Lame


LAME version 3.50 (www.sulaco.org/mp3) 
GPSYCHO: GPL psycho-acoustic model version 0.74. 

USAGE   :  lame [options] <infile> [outfile]

<infile> and/or <outfile> can be "-", which means stdin/stdout.

OPTIONS :
    -m mode         (s)tereo, (j)oint, (f)orce or (m)ono  (default j)
                    force = force ms_stereo on all frames. Faster and
                    uses special Mid & Side masking thresholds
    -b <bitrate>    set the bitrate, default 128kbps
                    (for VBR, this sets the allowed minimum bitrate)
    -s sfreq        sampling frequency of input file(kHz) - default 44.1
  --resample sfreq  sampling frequency of output file(kHz)- default=input sfreq
  --mp3input        input file is a MP3 file
  --voice           experimental voice mode

    -v              use variable bitrate (VBR)
    -V n            quality setting for VBR.  default n=4
                    0=high quality,bigger files. 9=smaller files
    -t              disable Xing VBR informational tag
    --nohist        disable VBR histogram display

    -h              use (maybe) quality improvements
    -f              fast mode (low quality)
    -k              disable sfb=21 cutoff
    -d              allow channels to have different blocktypes
  --athonly         only use the ATH for masking

    -r              input is raw pcm
    -x              force byte-swapping of input
    -a              downmix from stereo to mono file for mono encoding
    -e emp          de-emphasis n/5/c  (obsolete)
    -p              error protection.  adds 16bit checksum to every frame
                    (the checksum is computed correctly)
    -c              mark as copyright
    -o              mark as non-original
    -S              don't print progress report, VBR histograms

  Specifying any of the following options will add an ID3 tag
     --tt <title>     title of song (max 30 chars)
     --ta <artist>    artist who did the song (max 30 chars)
     --tl <album>     album where it came from (max 30 chars)
     --ty <year>      year in which the song/album was made (max 4 chars)
     --tc <comment>   additional info (max 30 chars)


MPEG1 samplerates(kHz): 32 44.1 48 
bitrates(kbs): 32 48 56 64 80 96 112 128 160 192 224 256 320 

MPEG2 samplerates(kHz): 16 22.05 24 
bitrates(kbs): 8 16 24 32 40 48 56 64 80 96 112 128 144 160

Gogo


GOGO-no-coda ver. 2.24 (Feb 12 2000)
Copyright (C) 1999 PEN@MarineCat and shigeo
          Special thanks to Keiichi SAKAI, URURI, Noisyu and Kei
This is based on LAME3.29beta and distributed under the LGPL
usage
gogo inputPCM [outputPCM] [options]

 inputPCM is input  wav file
if input.wav is `stdin' then stdin-mode
outputPCM is output mp3 file (omissible)

options
-b  kbps     bitrate [kpbs]
-br bps      bitrate [ bps]
-silent      dont' print progress report
-off         {3dn,mmx,kni(sse),e3dn}
-v {0,..,9}  VBR [0:high quality 9:high compression]
             You should combine this with -b option
for only RAW-PCM input
-offset bytes skip header size
  -8bit       8bit-PCM [dflt 16bit-PCM]
  -mono       mono-PCM [dflt stereo-PCM]
  -bswap      low, high byte swapping for 16bitPCM
  -s kHz      freq of PCM [dflt 44.1kHz]
-nopsy       disable psycho-acoustics
-m  {s,m,j}  output format s:stereo, m:mono, j:j-stereo
-d  kHz      change sampling-rate of output MP3
-emh {n,c,5} de-emphasis
-lpf {on,off} 16kHz filter [dflt use if <= 128kbps; not use if >= 160kbps]
-test        benchmark mode
-delete      delete input file, after encoding

RipEnc

RipEnc performs the same task as the code above, but is written in shell and is easier to use :)

Here's what it looks like.


RipEnc version 0.7, Copyright (C) 1999  Michael J. Parmeley
<mjparme@asde.com>, RipEnc comes with ABSOLUTELY NO WARRANTY


There is currently NO encoding process running in the background
Your encode.log file is 982607 bytes long.

<Enter 'd' for details, 'v' to view the encode log, or 'del' to delete the encode log>


1) Change working directory....................[/megajukebox/tmp]
2) Choose encoder..............................[lame]
3) Choose ripper...............................[cdparanoia]
4) Choose id3 tool.............................[none]
5) Toggle between Manual and CDDB naming.......[manual]
6) Setup XMCD_LIBDIR variable for CDA..........[/var/X11R6/lib/xmcd]
7) Set preferred naming convention.............[artist-name_of_song.mp3]
8) Rip whole CD?...............................[no]
9) Set small hard drive option?................[no]
10) Please select your Cd-Rom device...........[/dev/cdrom]
11) Set the Bitrate for the encoded MP3's......[256]
12) List the files in your working directory
13) Start
14) About
15) Exit
?

CD2MP3

Cd2mp3 is a single pass cdda to MP3 encoder. It will convert a audio track to MP3 without producing an intermediate wav file.

Here's how it looks in operation:


[dj@megajukebox]$ cd2mp3 options ALL
Using language: 1 - English.
Translator: Gustavo Sverzut Barbieri(k-s) <gsbarbieri@hotmail.com>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Cd2Mp3 1.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Author: Gustavo Sverzut Barbieri (k-s) <gsbarbieri@hotmail.com.br>
*** device: -D/dev/cdrom        type: -Icooked_ioctl
*** audio device: /dev/dsp
*** preset: tape
*** copyright: Yes
*** author: 
*** album: 

recording: '1' as 'track-1.mp3' (wait)
        Ok! (recorded)
recording: '2' as 'track-2.mp3' (wait)

Naturally you can feed it options from the command-line, here is a list:


dj@megajukebox]$ cd2mp3 --help

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Cd2Mp3 1.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Author: Gustavo Sverzut Barbieri (k-s) <gsbarbieri@hotmail.com.br>
Usage:
  cd2mp3 options <track_number>="<track name>" ... <track_number>="<track name>"or:  cd2mp3 options ALL  (to record all tracks)
or: cd2mp3 options LIST=<reclist_path>  (to read pairs: <track_number>="<track name>" from a file)
ou: cd2mp3 options PLAY=<track_number> VOL=[0..100] (only plays the track)

Options:
  DEV=<cdrom_device> (default: /dev/cdrom)
  DEV_TYPE=[generic_scsi|cooked_ioctl] (default: cooked_ioctl)
  AUDIO_DEV=<audio_device>  (default:/dev/dsp)
  LANGUAGE=<language_number> (LANGUAGE=help to see supported languages)
  COPYRIGHT=[YES|NO]
  PRESET=[phone|voice|fm|tape|hifi|cd|studio] (PRESET=help will give more info)
  ALBUM="<album's title>"
  AUTHOR="<author's name>"

10.2 GUI Based Encoders

GUI based encoders offer all the functionality of console based encoding, but wrap it all up in a nice easy to use interface. Grip and RipperX are similar in operation, both offer you the ability to select one, several or all tracks on a CD and convert them. They also offer CDDB support which allows you to retrieve the album and track information from a server and saves you having to enter the information by hand.

10.3 Encoder Performance

In the encoding sections I've mentioned 3 different encoders, bladeenc, lame and gogo. The main difference is their performance in encoding (although there are differences in the available options which were listed earlier).

A little example. I ripped a track from a CD and then encoded it with the different encoders. All encoders were run with the same system conditions and all produced stereo out mp3's.


[dj@megajukebox]$ ls -l cdda.wav 
-rw-rw-r--   1 dj       dj       59823164 Feb 10 00:56 cdda.wav

[dj@megajukebox]$ bladeenc cdda.wav -br 256

BladeEnc 0.91    (c) Tord Jansson          Homepage: http://bladeenc.mp3.no
===============================================================================
BladeEnc is free software, distributed under the Lesser General Public License.
See the file COPYING, BladeEnc's homepage or www.fsf.org for more details.

Files to encode: 1

Encoding:  ../test.wav
Input:     44.1 kHz, 16 bit, stereo.
Output:    128 kBit, stereo.

Completed. Encoding time: 00:05:58 (0.78X)                                   

All operations completed. Total encoding time: 00:05:58

--------------------------------------------------------------------------------

[dj@megajukebox]$ lame cdda.wav -b 256
LAME version 3.50 (www.sulaco.org/mp3) 
GPSYCHO: GPL psycho-acoustic model version 0.74. 
Encoding ../test.wav to ../test.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG1 LayerIII file
    Frame          |  CPU/estimated  |  time/estimated | play/CPU |   ETA
 10756/ 10756(100%)| 0:02:28/ 0:02:28| 0:02:29/ 0:02:29|    1.9074| 0:00:00 

--------------------------------------------------------------------------------

[dj@megajukebox]$ gogo cdda.wav -m s -b 256
GOGO-no-coda ver. 2.24 (Feb 12 2000)
Copyright (C) 1999 PEN@MarineCat and shigeo
          Special thanks to Keiichi SAKAI, URURI, Noisyu and Kei
MPEG 1, layer 3 stereo
inp sampling-freq=44.1kHz out sampling-freq=44.1kHz bitrate=256kbps
inp sampling-freq=44.1kHz out sampling-freq=44.1kHz bitrate=128kbps
input  file `../test.wav'
output file `../test.mp3'
{  10751/  10755} 100.0% (  2.94x)  re:[00:00:00.03] to:[00:01:35.42]
End of encoding
time=  95.430sec

It would appear that Gogo has a much optimised algorithm for encoding than Bladeenc and Lame.


11. Streaming MP3's.

A streaming server allows you to transmit MP3 files over a TCP based network. This can be the Internet itself or your local network / intranet.

The connection principal is very similar to that of a web server, files are streamed when a client (the MP3 player) connects to the server.

11.1 Icecast

After downloading and untaring, a good look around the doc/ directory would be a good thing, the HTML manual is very helpful and comprehensive.

If you have downloaded the source code, follow the instructions regarding compiling pertinent to your system.

Icecast will not work correctly unless you correctly set the servername in the config file, icecast.conf, which is located in the etc directory. It must match the name that resolves to your IP address exactly.

If you see the following line when Icecast starts-up you have problems:


-> [05/Jan/2000:17:21:04] WARNING: Resolving the server name [your.server.name] does not work!

Edit icecast.conf which is located in the etc directory and locate the line containing the entry for "server_name" and enter your servers name. If you are unsure you can find out by using the hostname command, or by cat'ing /etc/hosts.

Once you've made the neccesary changes you'll need to either copy the conf file to the bin directory, or start icecast with the -c option and specify the location, like so:


[dj@megajukebox bin]$ ./icecast -c ../etc/icecast.conf

If everything has been configured correctly, you should see something similar to the following:


[dj@megajukebox bin]$ ./icecast -c ../etc/icecast.conf -d /home/dj/mp3/icecast/  
Icecast Version 1.3.0 Starting...
Icecast comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Icecast under the terms of the
GNU General Public License.
For more information about these matters, see the file named COPYING.

[05/Jan/2000:18:36:30] Icecast Version 1.3.0 Starting..
[05/Jan/2000:18:36:30] Using stdin as icecast operator console
[05/Jan/2000:18:36:30] Tailing file to icecast operator console
[05/Jan/2000:18:36:30] Server started...
[05/Jan/2000:18:36:30] Listening on port 8000...
[05/Jan/2000:18:36:30] Using [megajukebox] as servername...
[05/Jan/2000:18:36:30] Max values: 1000 clients, 1000 clients per source, 10 sources, 5 admins
-> [05/Jan/2000:18:36:30] [Bandwidth: 0.000000MB/s] [Sources: 0] [Clients: 0] [Admins: 1] [Uptime: 0 seconds]

The -d option sets the directory for log files and templates.

Below is the list of command-line options:


        -c [filename] 

Parse as a configuration file. Please note that any command line
parameters you supply after this override whatever is in file. Also note that
icecast.conf in the current directory is already parsed when you specify
this file, so anything in icecast.conf not overridden by the new configuration
file will be used by the server. 

        -P [port] 

This is the port used for all client, source, and admin connections. It's set
to 8000 by default. 

        -m [max clients] 

Allow this number of client connections. When this number is reached, all
client connections will be refused with 'HTTP/1.0 504 Server Full' 

        -p [encoder password] 

This sets the password that the encoder must use to be allowed to stream
to the server. Note that if you have compiled the server with crypt()
support, this argument must be an encrypted string. 

        -b 

This will send the icecast server into the background (i.e daemon process).
To use the admin commands now, you have to connect to the server as an
admin, using some sort of telnet client. 

        -d [directory] 

Make all log files created by icecast, and all templates that icecast looks
for be relative to this directory. 

So, thats the server started, but you now need to connect an MP3 source to the server.

You can choose from two applications which deliver MP3 data to the server, Shout and LiveIce.

Shout

Shout provides Icecast with a static playlist of MP3's to stream and is included with Icecast.

You create the playlist if the MP3 files you want to stream with the following:


find [MP3 directory] -name '*.mp3' -print > playlist

At it's most basic level, to start the shout service, issue the following:


[dj@megajukebox bin]# ./shout megajukebox -P hackme -p playlist

The -P option specifies the password needed to add a mount-point to Icecast, this is the aptly set as hackme..... I strongly suggest you change it otherwise someone may :) The -p option specifies the location of the playlist file. Below is a list of all of the command line options:


[dj@megajukebox bin]# ./shout
Usage: shout <host> [options] [[-b <bitrate] file.mp3]...
Options:
        -B <directory>       - Use directory for all shout's files.
        -C <file>    - Use file as configuration file
        -D <dj_file> - Run this before every song (system())
        -P <password>        - Use specified password
        -S              - Display all settings and exit
        -V              - Use verbose output
        -X <desc>    - Use specified description.
        -a              - Turn on automatic bitrate (transfer) correction
        -b <bitrate> - Start using specified bitrate
        -d              - Activate the dj.
        -e <port>    - Connect to port on server.
        -f              - Skip files that don't match the specified bitrate
        -g <genre>   - Use specified genre
        -h              - Show this text
        -i              - Use old icy headers
        -k              - Don't truncate the internal playlist (continue)
        -l              - Go on forever (loop)
        -m <mount>   - Use specified mount point
        -n <name>    - Use specified name
        -o              - Turn of the bitrate autodetection.
        -p <playlist>        - Use specified file as a playlist
        -r              - Shuffle playlist (random play)
        -s              - (Secret) Don't send meta data to the directory server
        -u <url>     - Use specified url
        -v              - Show version
        -x              - Don't update the cue file (saves cpu)
        -z              - Go into the background (Daemon mode)
        -t              - Enable title streaming

LiveIce

LiveIce can work in 2 modes, it can pass a playlist to Icecast or can pass live audio from the soundcard.

After untaring and reading the README concerning building the package, make sure you have mpg123 installed and available as LiveIce requires it.

There are two ways of configuring LiveIce editing the config file with vi/emacs/or whatever or by using the TK based configuration tool, which is a pretty way of editing it :)

The best place for describing the internals of liveice.cfg can be found at LiveIce's homepage where Scott covers all of the options.

This is a copy of my config file with LiveIce set to mixer mode (stream from a list of MP3's)

NOTE: I've added comments to the file, so if you cut and paste make sure the comments haven't wrapped around to a new line otherwise LiveIce will not work :)


# liveice configuration file
# Automatically generated

SERVER megajukebox              # Your server name * MUST BE THE NAME THE SERVER RESOLVES TO *
PORT 8000                       # The port Icecast is running on

NAME Megajukebox                # Information regarding the name of your server which is sent to MP3 players, and
                                # to directory servers.  
                                # Examples 'Sarah FM' or 'ThisTown: Loud and Heavy Jazz - Internet Radio 24/7' 

GENRE Live                      # Information regarding the genre.  Examples 'Talk' or 'Dance'

DESCRIPTION                     # Information regarding the station.  Example 'The best for reggae in the North'

URL http://megajukebox:8000     # The URL and port of the server.

PUBLIC 0                        # Set this to 1 if you want Icecast to announce your station and list it's details
                                # on a directory server, otherwise leave 0

XAUDIOCAST_LOGIN                # can be either ICY_LOGIN or X_AUDIOCAST_LOGIN.  X_AUDIOCAST is better. 

MOUNTPOINT /techno              # Sets the mountpoint name of the stream for Icecast.  Only used if X_AUDIOCAST is used
                                # otherwise defaults to icy_0 

PASSWORD hackme                 # Icecast's admin password 

SAMPLE_RATE 44100               # The sample rate of the stream 
STEREO                          # Can be MONO or STEREO

NO_SOUNDCARD                    # See below

HALF_DUPLEX                     # Sets the soundcard duplex mode.  Can be HALF_DUPLEX or FULL_DUPLEX
USE_GOGO                        # Sets the encoder to use.  Check the README for the list
BITRATE 128000                  # Sets the bit rate of the stream (see below)
VBR_QUALITY 1                   # Sets the variable bit rate quality.

MIXER                           # See below

PLAYLIST /megajukebox/playlist  # Location of the playlist (see details on the find command later in this chapter) 

TRACK_LOGFILE track.log         # Filename and location to dump list of MP3's streamed

Once you have your config file you start LiveIce like so:
[dj@megajukebox liveice]$ ./liveice
/megajukebox/playlist
1
opening connection to megajukebox 8000
Attempting to Contact Server
connection successful: forking process
opening pipe!...
writing password
Setting up Interface
Soundcard Reopened For Encoding
Input Format: 16Bit 44100Hz Stereo
Output Format: 256000 Bps Mpeg Audio
IceCast Server: megajukebox:8000
Mountpoint: /techno
Name: megajukebox - this and that radio - broadcasting 24/7
Genre: Techno
Url: http://megajukebox.com
Description: a load of digital noise -> but i know you like it :)

 Press '+' to Finish
adding /megajukebox/demotunes/track_1.mp3
adding /megajukebox/demotunes/track_2.mp3
adding /megajukebox/demotunes/track_3.mp3
adding /megajukebox/demotunes/track_4.mp3
/megajukebox/demotunes/track_4.mp3
Adding New Channel 1
Adding New Channel 2
Channel 1 selecting 
 /megajukebox/demotunes/track_1.mp3
Channel 2 selecting 
 /megajukebox/demotunes/track_1.mp3
Playing track_1.mp3
searching for Id3v2
searching for Id3v1
copying the data
fixing the nulls
adding the url
closing input file
Using log track.log

The last line is a peak meter.

These are the keyboard controls for mixer mode:


Action                          Channel 1 Key   Channel 2 Key
~~~~~~                          ~~~~~~~~~~~~~   ~~~~~~~~~~~~~
Select next track on channel    1               a
Select prev track on channel    q               z
Start/Stop channel              2               s
Reset channel                   w               x
Increase volume on channel      3               d
Decrease volume on channel      e               c
Increase speed on channel       4               f
Decrease speed on channel       r               v
Sticky mode On/Random/Off       5               g
Preview channel                 t               b
Random Track                    u               m

The above liveice.cfg is for mixermode. To use LiveIce in audio mode change the line relating to MIXER to NOMIXER and set NO_SOUNDCARD to SOUNDCARD and restart LiveIce.

Forgetting to set the correct options will lead to some interesting warning ;)


   946:Error: Line In mode *and* no soundcard??????? Eeejit!

Once you have it all correctly set up and have plugged in an external source, you should be able to stream =:)


[dj@megajukebox liveice]$ ./liveice
/megajukebox/playlist
0
Initialising Soundcard
16Bit 22050Hz Stereo Full Duplex 
opening connection to megajukebox 8000
Attempting to Contact Server
connection successful: forking process
opening pipe!...
writing password
Setting up Interface
Soundcard Reopened For Encoding
Input Format: 16Bit 22050Hz Stereo
Output Format: 32000 Bps Mpeg Audio
IceCast Server: megajukebox:8000
Mountpoint: /daves_band_live_at_the_club
Name: megajukebox - Dave and the Dynamite - Live at the Roxy  
Genre: Live/Rock
Url: http://megajukebox
Description: megajukebox::Louder than a frog in a trashcan..... and almost as musical

 Press '+' to Finish
Lvl: L:   8704 R:  11776 

The last line is a signal level meter, if the input signal is too high you will get a *clip* warning. If you do, turn down the gain of the input source.

The keen eyed amongst you may of noticed that in liveice.cfg the first comment lines point out that the file is automatically generated. If you are using the TK based GUI liveiceconfigure.tk and you've made manual changes, you will lose them when you save. Either use the GUI or learn vi/emacs :)

11.2 Fluid

After untaring the bundle cd to the directory, then read the README :)

Fluid has three basic modes of operation, transmit, relay and forward. I'll only focus on transmit.

The config files associated for transmit are located in config/MP3TX.cfg. To test the server run with the following, at this point the default config settings should be ok:

java Fluid TX

Naturally enough you'll need Java of some form installed first. You can use either the Blackdown port of JDK available from http://www.blackdown.org or if you are using Redhat, Kaffe.

Fluid comes with a few sample MP3 files, so if everything is working you should see something similar to this (I've started the server using Kaffe in this example, you may have to start it using java):


[dj@megajukebox Fluid-Beta2J]$ kaffe Fluid tx
------- Fluid Streaming Server Beta 2 ------- 
This program is ShareWare(tm) and it will not 
be crippled in any way because of it. However 
if you do like the program and will use it    
commercial purposes, we ask of you to contact 
us at the address below for pricing info:     
                                              
 Eldean AB                  E-mail:           
 Sjoangsvagen 7             fluid@subside.com 
 S-192 72 Sollentuna                          
 SWEDEN                                       
                                              
   Fluid is Copyright Subside (C) 1998        
       written by Lars Samuelsson             
         http://www.subside.com               
--------------------------------------------- 

* Transmission mode *
Reading config from: config/MP3TX.cfg
Reading playlist: playlist.m3u
Server started on port: 2711
Accepting administrator login on port: 2710
P| Dr. Nick - Hello Everybody

If you get this far, it looks like things are working, but I'm sure you'll want to stream more than the demo files!

You'll need to compile a playlist of the MP3's you want to stream. This will be a static list users will not be able to alter this list or make requests. This playlist is named playlist.m3u and is located by default in the root directory.

To compile a playlist of all MP3's in a particular directory (or disk) use the following command:


find [MP3 directory] -name "*.mp3" -print > playlist.m3u

By default the server uses port 2711, which is where your listeners will connect to, if you need to change this this can be done in the config file.

The server can be remotely administered by telneting to it's admin port, by default port 2710 like so:


[dj@megajukebox Fluid-Beta2J]$ telnet localhost 2710
Trying 127.0.0.1..megajukebox
Connected to localhost.localdomain.
Escape character is '^]'.
jaguar
You are connected to the -Fluid- Streaming Server
Type "help" for a command reference
help
The following commands are available:
 help conn curr exit
curr
Information about the currently broadcasted song:
Title:   Beer Talk
Artist:  Homer Simpson
Album:   The Simpsons
Year:    1996
Comment: Borrowed this as an example
Genre:   Comedy

The reference to "jaguar" is the admin password, this is the default. There is no prompt for the password so please don't sit there waiting for one! I suggest that you change the password from the default otherwise you will invite a hack! This can be changed in the config file, which looks like this:
[dj@megajukebox config]$ cat MP3TX.cfg 
2711
2710
5
4096
32
1000
jaguar
playlist.m3u
current.txt

# --- The lines are ---
# 1. PORT number (the server will use)
# 2. PORT number (for maintaining the server remotely)
# 3. Maximum number of connections (the server will accept)
# 4  Packetsize when reading/sending (in bytes)
# 5. Bitrate of the mp3s in kbit/s (all mp3s must have same bitrate)
# 6. Delay between songs (in milliseconds)
# 7. Password for remote administration
# 8. Playlist name (list in .m3u format)
# 9. Name of the file to write song info to (from ID3-tag)

The reference to the playlist being in m3u format means that it is in the same format as produced by the find command mentioned earlier.

Update for RC1

Fluid has been updated, and released under a GPL License (Way to go Lars!)

Here are the main differences:

11.3 Litestream

Litestream is similar in it's operation to Icecast. The system is composed of the streamer and the source.

To start the streamer you issue a command in the following format:


[dj@megajukebox]$ litestream <source port> <stream host> <stream port> <max listeners> <log ident> [<yp host> <yp port>]

The options are as follows:

source port Is the port you connect the 'audio' source to.

stream host This is the IP or FQDN of your server (find this out with the hostname command for domain name or cat /etc/hosts for your IP address).

stream port This is the port number clients connect to.

max listeners This is the number of clients who can connect to your server.

log ident Log messages are written to /var/log/messages. <log ident> is a ident string used to identify the Litestream server, eg.

If you use the ident string 'Litestream' the server starting message in /var/log/messages would look similar to:


Sep 18 19:32:20 linux Litestream[1901]: stream.c:555: main: 'server started'

<yp host & yp port> These 2 options specify the host and port of an yp server, used to announce your server to mp3 directory servers.

Here is an example:


[dj@megajukebox]$ litestream 5000 megajukebox 5555 1000 LitestreamServer 

Ok, so that's the server system. Once started it sit's there waiting for an input to be connected, which is done with the source command.

The format is like so:


source <ip or hostname> <port> <name> <genre> <url> <irc> <icq> <aim> <public? (0, 1)> <reported bitrate (16, 18, 56, 128, etc.)> <playlist.txt> <log ident>

Below is the list of options for source.

ip or hostname is the hostname or IP address of the computer running Litestream Server.

port is the port on which Litestream Server is waiting for a streaming source.

name is the name of your stream.

genre is the genre of your stream.

url is the URL for your streams web page.

irc is the IRC channel for your stream.

icq is your ICQ ID.

aim is your AIM ID.

public is either 0 or 1. 0 for private, 1 for public.

reported bitrate is the stream bitrate which will be reported to the YP server. This does not necessarily reflect the actual bitrate of your stream.

playlist.txt is the name of the file containing your playlist.

log ident is the syslog identifier which will be prepended to each log message generated by Litestream Streaming Source.

Here is an example which would match the Litestream command earlier:


[dj@megajukebox]$ source megakukebox 5000 'Megajukebox  The best jukebox ever' Various  http://www.megajukebox.com \#megajukebox 0 N/A 1 128 /jukebox/playlist LitestreamSource

11.4 Apache::MP3 Module

The Apache:MP3 module allows the Apache WebServer to stream MP3's. It does not offer the same level of features as Fluid, Litestream & Icecast.

The module is dependant on MP3::Info and mod_perl, both of which are available on CPAN.

After downloading the files needed a read of the README will help things!

Firstly make the module, then make the config changes to Apache's config files (your changes may be made in either httpd.conf or srm.conf).

You will also have to create directories for icons and a directory hierarchy for MP3's.

Section 6 of the README details the editing (or creation) of a Perl config file.

This is to preload the MP3::Info module which without this may cause Apache to crash.

In httpd.conf create an entry like so:


 Perlrequire /etc/httpd/conf/startup.perl

Alter the /etc/httpd/conf reference to point to where your Apache config files are located on your system.

Now create the file startup.perl at the location specified above. At the very minimum you should have the following (again adjust the path of perl to fit your system).


[dj@megajukebox conf]$ cat /etc/httpd/conf/startup.perl

#!/usr/bin/perl

use MP3::Info();

Then restart Apache and point a web browser at one of your new MP3 directories :)

There is more documentation available on Apache::MP3, from the command-line run the following:


[dj@megajukebox conf]$ perldoc Apache::MP3

11.5 Firewall Bypassing

A large portion of companies and institutions now use firewalls to block users from connecting to certain ports on remote servers.

A way to bypass this is to run your MP3 server using port 80. You will not be able to run a webserver on the same URL or IP address.

When running Icecast in 'firewall bypass' mode you will need to start shout with the option to set the port to port 80, like so:


[dj@megajukebox bin]$ ./shout megajukebox -e 80 -P hackme -p ../playlist 

11.6 Bandwidth considerations

Streaming audio can consume vast quantities of bandwidth if the MP3 servers' bit-rate is set too high.

Consider this scenario. A T1 link has a capacity of approx. 1.55 Mb/Sec. If you stream your MP3's at 128K/Bps stereo, each connecting player will use 256K/Bps, so only 6 users could connect to your MP3 server at any time without problems. And at 256K/Bps, you will not get too many modem users connecting!

So you must make a decision at what to set your stream rates not only on what your server's internet connection is rated at, but what your users will be connecting at. 24K/Bps Stereo will give a reasonable quality signal that 56K modem users will be able to connect to, and for the same T1 line would allow approx. 32 simultaneous connections.

If your server is running on an Intranet, bandwidth issues will still have to be considered especially if your network is running 10M/Sec.

But please let either your ISP or sys admin know you are going to stream otherwise you may be in for a shock. Some ISP's will charge you for bandwidth over a certain limit and sys admins like to know why their network is now running slow :)

11.7 Copyright Issues

I think it's reasonable to assume that record companies will not like you streaming material without their permission or payment of some kind! So what can you stream?

This is an area where you will need to be aware of the legal ramifications, because it will be you who will be liable.

Below are two links, one for the Electronic Frontier Foundation who are advocates of freeing restrictions surrounding the technology. The other link is to the Recording Industry Association of America, which seeks to protect the rights of artists from piracy.

I strongly suggest visiting both of the sites, and any others relevant to where you are physically based.

http://www.eff.org/cafe/

http://www.riaa.com/weblic/weblic.htm


12. Listening to MP3's.

So, hopefully, you should now have some MP3 files ready to listen to, and have the choice of playing from file or stream.

12.1 Playing from File

Playing from file is reasonably straight-forward with all players. The only big difference is some are command-line based and some are X based.

Playing an MP3 file from file requires you to pass the mp3 file as a parameter, like so:


[dj@megajukebox]$ mpg123 /mp3_files/SampleFile.mp3

or

[dj@megajukebox]$ xaudio /mp3_files/SampleFile.mp3

If you want to play a series of files, pass them in as a list:


[dj@megajukebox]$ alsaplayer /mp3_files/SampleFile1.mp3 /mp3_files/SampleFile2.mp3

To play all the tracks in a directory, just wildcard the file selected, like so:


[dj@megajukebox]$ xmms /mp3_files/*.mp3

12.2 Playing from MP3 Streams

Playing from a MP3 stream is quite easy, just replace the file with the streams url and port number:


[dj@megajukebox]$ mpg123 http://localhost:8000

or

[dj@megajukebox]$ freeamp http://megajukebox:2711

12.3 Capturing MP3 Streams

A stream from a MP3 server can be captured and save locally using the following:

Streamripper

To capture an MP3 stream using streamripper, type the following:


[dj@megajukebox]$ streamripper -h megajukebox -p 8000 
Press CTRL-C to stop
name: Megajukebox 
reponse: 200
genre: Megajukebox 
url: http://www.megajukebox.com/
bitrate: 128
This stream contains no meta data, ripping as one large ass track
1st track ripped
socket error: : Success

Here's a list of options.


[dj@megajukebox]$ streamripper 
Usage: streamripper -h <host> -p <port> [-d dir]
Options:
        -h <host>      - Required: The host name
        -p <port>      - Required: The host port, typically 8000
        -d <dir>       - Optional: The destination directory
        -l <logfile>   - Optional: Output everything to a log file <logfile>
        -v             - Optional: Be extra verbose
        -c             - Optional: Don't display status counter
        -q             - Optional: Quiet mode, don't make mp3 files
        -s             - Optional: Output stream to stdout for mpg123
        -n             - Optional: Wait until next track before writing
        -o             - Optional: Create a directory with the stream name for output

wget

To save a stream using wget:


[dj@megajukebox]$ wget http://megajukebox:8000 -O download01.mp3
--13:41:41--  http://megajukebox:8000/
           => `download01.mp3'
Connecting to megajukebox:8000... connected!
HTTP request sent, awaiting response... 200 OK
Length: unspecified [audio/mpeg]

    0K -> .......... .......... .......... .......... ..........
   50K -> .......... .......... .......... .......... ..........
  100K -> .......... .......... .......... .......... ..........
  150K -> .......... .......... .......... .......... ..........
  200K -> .......... .......... .......... .......... ..........
  250K -> .......... .......... .......... .......... ..........
  300K -> .......... .......... .......... .......... ..........
  350K -> .......... .......... .......... .......... ..........
  400K -> .......... .......... .......... .......... ..........
  450K -> .......... .......... .......... .......... ..........
  500K -> .......... .......... .......... .......... ..........

12.4 Mixing

eMixer

eMixer gives you the ability to mix MP3's in a similar manner to a DJ's mixing desk.

Newer versions support 2 sound cards so you can output your mix on one card and monitor or cue the next track on another.

As usual once untaring, read the readme on how to build the package.

You will need to create a playlist of MP3 files, do this with the find command mentioned in the Streaming section.

You will need mpg123 installed before you can run eMixer.

Here are the control keys (taken from the readme)


KEYBOARD CONTROLS
"up, down"              scroll thru playlist
"page up, page down"    scroll thru playlist screen full at a time 
"enter"                 start/stop track
"tab"                   change channel
"}","]"                 toggle between volume and speed controls/windows 
"space"                 restart active track
"left, right"           fader controls
"insert"                decrease volume/speed in channel one  
"home"                  increase volume/speed in channel one  
"delete"                decrease volume/speed in channel two  
"end"                   increase volume/speed in channel two  
"< , / , >"             left, center & right positions of fader
" + , = "       (NEW)   switch between faders 
" q "                   start/stop channel channel one
" w "                   start/stop channel channel two
" p "                   toggle between playmodes - single, loop, continuous, random
" a "                   stop all channels
" f "                   file menu
" u "                   util menu
" h "                   help menu
" ~, ` "                cancel menu drop down
" s "                   turn SIM Play on
                        (SIM Play starts the same track in both channels
                        simultaneously ) 

GDAM

GDAM is a GUI based MP3 mixer with a large bank of built in, real-time effects.


13. ID3 Editing.

ID3 tags are information fields contained within the MP3 data that contain information about the MP3 such as who the artist is, what album the track came from, and so on.

Editors allow you to view and edit this information.

13.1 id3ed


[dj@megajukebox]$ id3ed 
id3ed v1.10 - mpeg layer 3 file information editor
Usage: id3ed [-s songname] [-n artist] [-a album] [-y year] [-c comment]
             [-k tracknum] [-g genre] [-q] [-SNAYCKG] [-l/-L] [-r]
             [-i] <mp3files> [-v]

  -q                    no line interface; only set tags specified on command
                        line. Use twice to suppress all output except errors.
  -SNAYCKG              prompt to edit the specified tags only
                        Other tags can still be set with the -[snaycg] options.
  -l/-L                 display list of genres
  -r                    remove id3 tag from files
  -i                    show current id3 tag only, don't edit
  -v                    output program version/license


[dj@megajukebox MyBand]$ id3ed track01.mp3 

File track01.mp3: (tag v1.1)
songname[max:30]: Our Kick Ass Demo
artist[max:30]: Us       
album[max:30]: White Album
year[max:4]: 1999
comment[max:28]: Will be a classic some day!
tracknum[max:3]: 1
genre[0-255/name]: 5     

If we now want to see the Id info we run id3ed with the -i flag, like so:


[dj@megajukebox MyBand]$ id3ed -i track01.mp3 
track01.mp3: (tag v1.1)
songname: Our Kick Ass Demo
artist: Us
album: White Album
year: 1999
comment: Will be a classic some day!
tracknum: 1
genre: Funk(5)

13.2 mp3info

MP3info works in a similar manner to id3ed, here is a snippet from it's man pages:


SYNOPSIS
       mp3info [ -option < value > ] filename[s]...

DESCRIPTION
       This is a small tool to get and set MP3 information.

OPTIONS
       -T     Do  NOT  get  TAG  Info.  Use on slowseeking media,
              since TAG is at the very end of the file.

       -s <0/1>
              Print info. Pretty  much  obsolete,  as  it  always
              should be on.  Defaults 1.

       -f <format>
              Format of printed string. See README for details.

       -F <Formatnumber>
              Predefined format of printed string. Try it out.

       -w     Write  TAG Info. Will write a TAG at the end of the
              file.
       -W     Wipe TAG Info. Will wipe clean TAG Info.  Overrides
              all  other  TAG  Options, and turns -s off. To both
              wipe tag and display info, use -W -s 1

       -n <name>
              Set song title. Implies -w. Will go away soon,  use
              -t instead.

       -t <name>
              Set song title. Alias for -n. Implies -w.

       -a <artist>
              Set name of artist. Implies -w.

       -l <album>
              Set album name. Implies -w.

       -y <year>
              Sets published year. Implies -w.

       -c <comment>
              Sets comment. Implies -w.

       -g <genre>
              Set genre number. Implies -w.

       -G <genrename>
              Set genre by name. Implies -w.

13.3 ID3 Genre codes

ID3 uses a code to refer to the genre, here is the code listing [info taken from http://www.id3.org/id3v2-00.txt].


The following genres are defined in ID3v1 

      0.Blues
      1.Classic Rock
      2.Country
      3.Dance
      4.Disco
      5.Funk
      6.Grunge
      7.Hip-Hop
      8.Jazz
      9.Metal
     10.New Age
     11.Oldies
     12.Other
     13.Pop
     14.R&B
     15.Rap
     16.Reggae
     17.Rock
     18.Techno
     19.Industrial
     20.Alternative
     21.Ska
     22.Death Metal
     23.Pranks
     24.Soundtrack
     25.Euro-Techno
     26.Ambient
     27.Trip-Hop
     28.Vocal
     29.Jazz+Funk
     30.Fusion
     31.Trance
     32.Classical
     33.Instrumental
     34.Acid
     35.House
     36.Game
     37.Sound Clip
     38.Gospel
     39.Noise
     40.AlternRock
     41.Bass
     42.Soul
     43.Punk
     44.Space
     45.Meditative
     46.Instrumental Pop
     47.Instrumental Rock
     48.Ethnic
     49.Gothic
     50.Darkwave
     51.Techno-Industrial
     52.Electronic
     53.Pop-Folk
     54.Eurodance
     55.Dream
     56.Southern Rock
     57.Comedy
     58.Cult
     59.Gangsta
     60.Top 40
     61.Christian Rap
     62.Pop/Funk
     63.Jungle
     64.Native American
     65.Cabaret
     66.New Wave
     67.Psychadelic
     68.Rave
     69.Showtunes
     70.Trailer
     71.Lo-Fi
     72.Tribal
     73.Acid Punk
     74.Acid Jazz
     75.Polka
     76.Retro
     77.Musical
     78.Rock & Roll
     79.Hard Rock
     
   The following genres are Winamp extensions
     
     80.Folk
     81.Folk-Rock
     82.National Folk
     83.Swing
     84.Fast Fusion
     85.Bebob
     86.Latin
     87.Revival
     88.Celtic
     89.Bluegrass
     90.Avantgarde
     91.Gothic Rock
     92.Progressive Rock
     93.Psychedelic Rock
     94.Symphonic Rock
     95.Slow Rock
     96.Big Band
     97.Chorus
     98.Easy Listening
     99.Acoustic
    100.Humour
    101.Speech
    102.Chanson
    103.Opera
    104.Chamber Music
    105.Sonata
    106.Symphony
    107.Booty Bass
    108.Primus
    109.Porn Groove
    110.Satire
    111.Slow Jam
    112.Club
    113.Tango
    114.Samba
    115.Folklore
    116.Ballad
    117.Power Ballad
    118.Rhythmic Soul
    119.Freestyle
    120.Duet
    121.Punk Rock
    122.Drum Solo
    123.A capella
    124.Euro-House
    125.Dance Hall


14. MP3 to Minidisc.

By Afra <afra@prongs.org>

To record MP3s from Linux to your minidisc, there are two methods: analog and digital. Each method is dependant on the type of soundcard your Linux box has. The main difference between analog and digital recordings is the sound quality you achieve during recording. With an analog recording you may hear some static noise/fuzz, although some analog soundcards try to minimize this. Don't think that just because you have an analog sound card that you are doomed, because you are not. This just means you will have to spend a little time trying to minimize the noise by fiddling with mixer settings.

No special software is required, just a regular MP3 player for your Linux box. Basically both methods will require a connection from your soundcard's output to your Minidic's input.

14.1 Analog Recording

If your soundcard does not have a "Digital Out" connection, you may will have to go via the analogue recording route.

To record an MP3 from your Linux box onto your Minidisc, connect an analog chord from your sound card's Line Out to your Minidisc's Line In input. Set your Minidisc in the recording mode as you usually would and play the MP3. You should see the recording levels on your Minidisc rise. Upon playback, you may notice a small or large amount of static noise, which is due to your soundcard.

To minimize the static noise during recording, keep your Minidisc's recording/volume levels within the -3dB and 0dB range. To help clear up the noise you may hear connect up your Minidisc as described above and turn on the Recording Mode but do not play an MP3. You should still hear the noise and this may help in fiddling with your mixer effects.

14.2 Digital Recording

You will experience better sound quality with digital recording. Connect your optical cable (if you have to buy one, the sizes of the MD and card port matter, usually 3.5mm but check your soundcard and Minidisc user manual) to your sound card's Digital Out.

The cable should now be glowing on the other end - good. Now, connect the glowing end to your minidisc Digital Input. Set your minidisc in record mode and play the mp3 from the computer.

14.3 Playlists

There is one problem when playing MP3 tracklistings: how will your Minidisc know when to set an automark when a track jumps onto another (ie. change track numbers automatically)? The solution is this MP3 file which you can download at http://www.prongs.org/minidisc/2sec.zip.

You may use this file, which is an MP3 file containing 2 seconds of silence, to insert before each MP3 on your playlist, so the MD will know when to automark.


15. Feedback.

New hardware and software is being released all the time. If you are using newer versions of the hardware and / or software listed within this document, or can add to anything within this area, please send your information for inclusion to phil@plus24.com and I'll include it in the next release.

While I'd like to reply to every question, please note that on occasions I will not be able to reply quickly due to work.

Happy MP3'ing!!