The Linux MP3-HOWTO - Linux Documentation ProjectFor encoding MP3's from CD−ROM, the speed or type...

44
The Linux MP3-HOWTO

Transcript of The Linux MP3-HOWTO - Linux Documentation ProjectFor encoding MP3's from CD−ROM, the speed or type...

Page 1: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

The Linux MP3−HOWTO

Page 2: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Table of ContentsThe Linux MP3−HOWTO ................................................................................................................................1

By Phil Kerr, phil@plus24.com...............................................................................................................11. Introduction..........................................................................................................................................12. Copyright of this document.................................................................................................................13. Where to get this document.................................................................................................................14. Acknowledgments................................................................................................................................15. Disclaimer............................................................................................................................................16. Hardware Requirements & Performance Issues..................................................................................17. Software Requirements........................................................................................................................18. Setting up your system.........................................................................................................................19. Encoding from Audio..........................................................................................................................210. Encoding from CD−ROM.................................................................................................................211. Streaming MP3's................................................................................................................................212. Listening to MP3's.............................................................................................................................213. ID3 Editing........................................................................................................................................214. MP3 to Minidisc................................................................................................................................215. Feedback............................................................................................................................................21. Introduction..........................................................................................................................................22. Copyright of this document.................................................................................................................33. Where to get this document.................................................................................................................33.1 Translations........................................................................................................................................34. Acknowledgments................................................................................................................................45. Disclaimer............................................................................................................................................46. Hardware Requirements & Performance Issues..................................................................................57. Software Requirements........................................................................................................................67.1 Rippers & WAV Recorders...............................................................................................................67.2 Encoders.............................................................................................................................................77.3 Players................................................................................................................................................87.4 Streaming Servers..............................................................................................................................97.5 Mixing..............................................................................................................................................107.6 ID3 Editors.......................................................................................................................................117.7 Stream Grabbers...............................................................................................................................117.8 Misc.................................................................................................................................................118. Setting up your system.......................................................................................................................128.1 Setting up for Analogue Audio Capture..........................................................................................128.2 Setting up for CD−ROM Audio Capture.........................................................................................138.3 Additional Setting up.......................................................................................................................139. Encoding from Audio........................................................................................................................1310. Encoding from CD−ROM...............................................................................................................1410.1 Command Line encoding...............................................................................................................15

RipEnc......................................................................................................................................18CD2MP3...................................................................................................................................19

10.2 GUI Based Encoders......................................................................................................................2010.3 Encoder Performance.....................................................................................................................2011. Streaming MP3's..............................................................................................................................2111.1 Icecast............................................................................................................................................21

Shout.........................................................................................................................................23LiveIce......................................................................................................................................24

The Linux MP3−HOWTO

i

Page 3: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Table of Contents11.2 Fluid...............................................................................................................................................27

Update for RC1.........................................................................................................................2911.3 Litestream......................................................................................................................................2911.4 Apache::MP3 Module....................................................................................................................3011.5 Firewall Bypassing........................................................................................................................3111.6 Bandwidth considerations..............................................................................................................3211.7 Copyright Issues............................................................................................................................3212. Listening to MP3's...........................................................................................................................3212.1 Playing from File...........................................................................................................................3312.2 Playing from MP3 Streams............................................................................................................3312.3 Capturing MP3 Streams.................................................................................................................33

Streamripper..............................................................................................................................33wget...........................................................................................................................................34

12.4 Mixing............................................................................................................................................34eMixer.......................................................................................................................................35GDAM......................................................................................................................................35

13. ID3 Editing......................................................................................................................................3513.1 id3ed...............................................................................................................................................3613.2 mp3info..........................................................................................................................................3613.3 ID3 Genre codes............................................................................................................................3714. MP3 to Minidisc..............................................................................................................................4014.1 Analog Recording .........................................................................................................................4014.2 Digital Recording ..........................................................................................................................4014.3 Playlists .........................................................................................................................................4015. Feedback..........................................................................................................................................41

The Linux MP3−HOWTO

ii

Page 4: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

The Linux MP3−HOWTO

By Phil Kerr, [email protected]

v1.61, 2001−12−16

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

1. Introduction.

2. Copyright of this document.

3. Where to get this document.

3.1 Translations•

4. Acknowledgments.

5. Disclaimer.

6. Hardware Requirements & Performance Issues.

7. Software Requirements.

7.1 Rippers & WAV Recorders• 7.2 Encoders• 7.3 Players• 7.4 Streaming Servers• 7.5 Mixing• 7.6 ID3 Editors• 7.7 Stream Grabbers• 7.8 Misc•

8. Setting up your system.

8.1 Setting up for Analogue Audio Capture• 8.2 Setting up for CD−ROM Audio Capture• 8.3 Additional Setting up•

The Linux MP3−HOWTO 1

Page 5: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

9. Encoding from Audio.

10. Encoding from CD−ROM.

10.1 Command Line encoding• 10.2 GUI Based Encoders• 10.3 Encoder Performance•

11. Streaming MP3's.

11.1 Icecast• 11.2 Fluid• 11.3 Litestream• 11.4 Apache::MP3 Module• 11.5 Firewall Bypassing• 11.6 Bandwidth considerations• 11.7 Copyright Issues•

12. Listening to MP3's.

12.1 Playing from File• 12.2 Playing from MP3 Streams• 12.3 Capturing MP3 Streams• 12.4 Mixing•

13. ID3 Editing.

13.1 id3ed• 13.2 mp3info• 13.3 ID3 Genre codes•

14. MP3 to Minidisc.

14.1 Analog Recording • 14.2 Digital Recording • 14.3 Playlists •

15. Feedback.

1. Introduction.

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

It covers:

The Linux MP3−HOWTO

9. Encoding from Audio. 2

Page 6: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Encoding MP3's from a live or external source• Encoding MP3's from audio CD's• Streaming MP3's over a network• Listening to MP3's• Recording MP3 streams• Mixing MP3's• Editing ID3 information•

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 havereceived 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 Projecthttp://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, thetranslations take time.

Korean

http://kldp.org/HOWTO/MP3−HOWTO By Lee,So−min <[email protected]>

French

http://www.freenix.org/unix/linux/HOWTO/MP3−HOWTO.html By Arnaud Gomes−do−Vale<[email protected]>

Hungarian

http://free.netlap.hu/howto/MP3−HOGYAN.html By Andras Timar <[email protected]>

Italian

ftp://ftp.pluto.linux.it/pub/pluto/ildp/HOWTO/MP3−HOWTO By Mariani Dario <[email protected]>

Spanish

The Linux MP3−HOWTO

2. Copyright of this document. 3

Page 7: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

http://www.insflug.org/documentos/MP3−Como By Arielo <[email protected]>

Dutch

http://nl.linux.org/doc/HOWTO/MP3−HOWTO−NL.html By Reggy Ekkebus <[email protected]>

Japanese

http://www.linux.or.jp/JF/JFdocs/MP3−HOWTO.html By Saito Kan <can−[email protected]>

Slovene

http://www.lugos.si/delo/slo/HOWTO−sl/MP3−HOWTO−sl.html By Jernej Kovacic <[email protected]>

Many thanks to the above translators. If you can translate this HOWTO, please drop the author an email. Alsoplease 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 theSound−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 servicemark.

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

The Linux MP3−HOWTO

4. Acknowledgments. 4

Page 8: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

6. Hardware Requirements & Performance Issues.

Digital Audio processing is a resource intensive task that relies heavily on the processing and I/O capabilitiesof 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 PCIsoundcard will give the best results. The I/O performance difference between an ISA and PCI based card issignificant, over 132 MBytes/sec for PCI (quote taken from the PCI−HOWTO). Naturally, the better thequality of the soundcard in terms of its signal−to−noise ratio, the better the encoded MP3. I've been using theSoundblaster PCI128 and just switched over to a Soundblaster Live Value; both cards give good audioperformance, 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 4or UDMA is preferable as the transfer rate is sufficiently high enough to provide reliable data transfer withoutproblems.

The ideal solution would be to use a SCSI based system as the drives and interface have far better throughputcapabilities, a sustained 5MB/sec for SCSI 1 through to 40−80MB/sec for ultra−ultra2/wide SCSI. IDE canpeak at anything from 8.3 MB/s to 66 MB/s for Ultra DMA mode 4 but these speeds are peak, averagetransfer rates will be slower. If you can find, or afford, an AV SCSI drive, go for it. AV drives have had theread/write head system optimised for continuous data transference; other SCSI and IDE drives normallycannot 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 asa 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 torecord the signal. If you are recording one−off events, such as live performances invest in a good SCSI baseddisk system.

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

Virtual memory paging will also cause glitches, so run with as much physical RAM as you can, I'drecommend 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 anyharm either.

The Linux MP3−HOWTO

6. Hardware Requirements & Performance Issues. 5

Page 9: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

While the hardware specifications above will give you a decent system to encode audio data, don't discountusing 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 resultwill probably be a happier Linux box.

Another important issue is the audio cabling. Cheap, poor quality cables and connectors will result in poorrecording 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 fromdata 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 beenoptimised.

For encoding MP3's from CD−ROM, the speed or type of drive will determine the time taken to read the rawinformation 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, eitherusing the internal connector or by connecting headphone's to the headphone output, although you will not beable 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 theSound−HOWTO.

7. Software Requirements.

Converting audio to MP3's is normally a 2 stage process, first the audio is recorded into a WAV format, thenthe 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 needto produce the WAV file.

If you are wanting to encode from audio input, you will need a program that will record from yoursoundcard's input and save the results in a WAV format. Below are some useful utilities (most of thecomments 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:

The Linux MP3−HOWTO

7. Software Requirements. 6

Page 10: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 Paranoiasource is included in the cdparanoia source distribution). Like the original cdda2wav, cdparanoia packagereads audio from the CDROM directly as data, with no analog step between, and writes the data to a file orpipe in WAV, AIFC or raw 16 bit linear PCM. Compared to cdda2wav, it's much slower but really gets thebest 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. Itutilizes CDDB lookups to automate the naming of songs as they are ripped. A manual naming option is alsoavailable. 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, LameMp3 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 cdparanoiabuilt in, but can also use external rippers (such as cdda2wav). It also provides an automated frontend for MP3encoders, letting you take a disc and transform it easily straight into MP3s. The CDDB protocol is supportedfor 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:

The Linux MP3−HOWTO

7.2 Encoders 7

Page 11: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Blade's MP3 Encoder

BladeEnc is a freeware MP3 encoder. It is based on the same ISO compression routines as mpegEnc, so youcan expect roughly the same, or better, quality . The main difference is the appearance and speed. BladeEncdoesn't have a nice, user−friendly interface like mpegEnc, but it is more than three times faster, and it workswith 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 mp3encoder. It is a GPL'd patch against the dist10 ISO demonstration source. LAME is totally incapable ofproducing an mp3 stream. It is incapable of even being compiled by itself. You need the ISO source for thissoftware to work. The ISO demonstration source is also freely available, but any commercial use (includingdistributing 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 byPEN@MarineCat, Keiichi SAKAI, URURI, kei and shigeo. (You will also need to download NASM tocompile 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 somespecials 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 targetedat 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 libraryand driver quite a bit. It has some very interesting features unique to Linux/Unix players. The goal is to createa fully pluggable framework for playback of all sorts of media with the focus on PCM audio data. Full speed

The Linux MP3−HOWTO

7.3 Players 8

Page 12: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

(pitch) control, positive *and* negative! First Linux− and only GPL player that does this!! MP3's and CD'sdo 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 layers1, 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/orreduced 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 XingMPEG decoder which makes it one of the fastest and best sounding players available. FreeAmp provides anumber 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 theinternet itself.

Icecast

Welcome! Icecast is a Mpeg Layer III Audio broadcasting system brought to you by the linuxpower.orgteam. Icecast comes bundled with iceplay, and icedir. Iceplay is a playlist streamer that will allow you to sendpre−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 mp3format.

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/

The Linux MP3−HOWTO

7.4 Streaming Servers 9

Page 13: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 libraryfor 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. Unlikeclients 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 websitebelow:

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−likecapabilities from the computer console. eMixer is also very able in a "real time" party environment. eMixer isbased 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 mixedsimultaneously. Effects can be added, changed, and rearranged dynamically. GDAM features a client−serverarchitecture; all sound is produced by a server, which receives instructions from any number of clients. Otherfeatures include plugins for audio effects and interface components, caching and looping, sequencing,assisted beatmatching, a waveform viewer/beat calculator, contiguous queuing (no pauses between songswhen using a playlist), an online help system, an mpg123 clone which runs on a gdam server, flexiblecommand line interface for direct control of server, recording of entire mix or any point in stream tobuffer/disk/mp3 encoder, support for multiple sound devices, and support for midi hardware control.

http://gdam.org/

alternative:

http://gdam.sourceforge.net

The Linux MP3−HOWTO

7.5 Mixing 10

Page 14: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 acombination 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−lineand 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 aseparate 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 andFTP, the two most widely used Internet protocols. It works non−interactively, thus enabling work in thebackground, 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 soundlevel.

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

The Linux MP3−HOWTO

7.6 ID3 Editors 11

Page 15: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Sox is a very handy sound conversion utility which I'd recommend having, and you will need it if you wish touse 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 analogueor CD−ROM source.

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

Naturally a reasonable prerequisite is a working soundcard. At this point in the HOWTO, I invite you to readthe excellent Linux Sound HOWTO, by Jeff Tranter. After which a good read of the Linux Sound PlayingHOWTO, by Yoo C. Chung. Both of the above mentioned HOWTO's cover the details of getting a soundsystem 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, somecommon ones are:

Line out to Soundcard Line in. Most audio devices have a Line output sockets. Line level is a standard thatspecifies what voltage the audio device will send out. If I remember correctly it is 500mV for domestic andSemi Pro devices, and 750mV for Pro audio devices. I would guess that the standard set for most soundcardswill be 500mV, but some of the newer Pro audio may be to the higher standard It shouldn't make too muchdifference 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 TapeDecks, 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 Geta 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 isessentially 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 inLine level devices. If you were to plug a Microphone into the Soundcard Line in, chances are you wouldnever record anything.

WARNING, doing the reverse, plugging a Line level device into the Soundcards Microphone input, can

The Linux MP3−HOWTO

8. Setting up your system. 12

Page 16: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 amicrophone input and expect good results. The output requires equalization, as records are mastered withless bass and more treble to optimize the physics of the moving needle. This equalization is carefully definedand referred to as RIAA equalization. You *need* to run the output through a phono preamp first, and theninto a line input.

Music keyboards & synths should be connected to the Soundcards Line in, with guitars connecting to Line invia 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 yoursoundcard, 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 enoughto give you a decent recording level, but aren't too loud and distorting. I normally just judge this by ear, aftera 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, especiallywhen encoding from an audio source. This is to ensure that the bare minimum of services are running andthus 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 thismainly for the performance gains in using a SCSI drive. Also, recording onto a dedicated drive, where youare almost certain the head isn't going to suddenly skip to another part of the drive as you are writing audiodata 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 minutetakes nearly 10 Mb (5 MB per channel).

The Linux MP3−HOWTO

8.2 Setting up for CD−ROM Audio Capture 13

Page 17: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 tobladeenc 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 ofoptions.

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 isextracted 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 basedare easier to use (and look nicer).

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

The Linux MP3−HOWTO

10. Encoding from CD−ROM. 14

Page 18: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 atyour 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 WAVfile. 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 withouthaving to use the batch mode of Cdparanoia. This cuts down on free disk space needed as Cdparanoia's batchmode will rip the whole disk, and take up anything upto 600 Meg.

The Linux MP3−HOWTO

10.1 Command Line encoding 15

Page 19: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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.

The Linux MP3−HOWTO

10.1 Command Line encoding 16

Page 20: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

The Linux MP3−HOWTO

10.1 Command Line encoding 17

Page 21: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

inputPCM is input wav fileif input.wav is `stdin' then stdin−modeoutputPCM 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 optionfor 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<[email protected]>, RipEnc comes with ABSOLUTELY NO WARRANTY

There is currently NO encoding process running in the backgroundYour 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]

The Linux MP3−HOWTO

RipEnc 18

Page 22: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 directory13) Start14) About15) Exit?

CD2MP3

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

Here's how it looks in operation:

[dj@megajukebox]$ cd2mp3 options ALLUsing language: 1 − English.Translator: Gustavo Sverzut Barbieri(k−s) <[email protected]>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Cd2Mp3 1.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Author: Gustavo Sverzut Barbieri (k−s) <[email protected]>*** 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) <[email protected]>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>"

The Linux MP3−HOWTO

CD2MP3 19

Page 23: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 touse interface. Grip and RipperX are similar in operation, both offer you the ability to select one, several or alltracks on a CD and convert them. They also offer CDDB support which allows you to retrieve the album andtrack 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 differenceis their performance in encoding (although there are differences in the available options which were listedearlier).

A little example. I ripped a track from a CD and then encoded it with the different encoders. All encoderswere 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.wavInput: 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 256LAME version 3.50 (www.sulaco.org/mp3) GPSYCHO: GPL psycho−acoustic model version 0.74. Encoding ../test.wav to ../test.wav.mp3Encoding 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 256GOGO−no−coda ver. 2.24 (Feb 12 2000)Copyright (C) 1999 PEN@MarineCat and shigeo Special thanks to Keiichi SAKAI, URURI, Noisyu and KeiMPEG 1, layer 3 stereoinp sampling−freq=44.1kHz out sampling−freq=44.1kHz bitrate=256kbpsinp sampling−freq=44.1kHz out sampling−freq=44.1kHz bitrate=128kbpsinput file `../test.wav'

The Linux MP3−HOWTO

10.2 GUI Based Encoders 20

Page 24: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

output file `../test.mp3'{ 10751/ 10755} 100.0% ( 2.94x) re:[00:00:00.03] to:[00:01:35.42]End of encodingtime= 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 itselfor your local network / intranet.

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

11.1 Icecast

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

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

Icecast will not work correctly unless you correctly set the servername in the config file, icecast.conf, whichis 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 thehostname 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 starticecast 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...

The Linux MP3−HOWTO

11. Streaming MP3's. 21

Page 25: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Icecast comes with NO WARRANTY, to the extent permitted by law.You may redistribute copies of Icecast under the terms of theGNU 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 lineparameters you supply after this override whatever is in file. Also note thaticecast.conf in the current directory is already parsed when you specifythis file, so anything in icecast.conf not overridden by the new configurationfile will be used by the server.

−P [port]

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

−m [max clients]

Allow this number of client connections. When this number is reached, allclient 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 streamto 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 anadmin, using some sort of telnet client.

−d [directory]

Make all log files created by icecast, and all templates that icecast looksfor 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.

The Linux MP3−HOWTO

11. Streaming MP3's. 22

Page 26: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 ashackme..... I strongly suggest you change it otherwise someone may :) The −p option specifies the location ofthe playlist file. Below is a list of all of the command line options:

[dj@megajukebox bin]# ./shoutUsage: 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

The Linux MP3−HOWTO

Shout 23

Page 27: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 mpg123installed 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 theTK 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 Scottcovers 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 wrappedaround 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_DUPLEXUSE_GOGO # Sets the encoder to use. Check the README for the listBITRATE 128000 # Sets the bit rate of the stream (see below)VBR_QUALITY 1 # Sets the variable bit rate quality.

MIXER # See below

The Linux MP3−HOWTO

LiveIce 24

Page 28: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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/playlist1opening connection to megajukebox 8000Attempting to Contact Serverconnection successful: forking processopening pipe!...writing passwordSetting up InterfaceSoundcard Reopened For EncodingInput Format: 16Bit 44100Hz StereoOutput Format: 256000 Bps Mpeg AudioIceCast Server: megajukebox:8000Mountpoint: /technoName: megajukebox − this and that radio − broadcasting 24/7Genre: TechnoUrl: http://megajukebox.comDescription: a load of digital noise −> but i know you like it :)

Press '+' to Finishadding /megajukebox/demotunes/track_1.mp3adding /megajukebox/demotunes/track_2.mp3adding /megajukebox/demotunes/track_3.mp3adding /megajukebox/demotunes/track_4.mp3/megajukebox/demotunes/track_4.mp3Adding New Channel 1Adding New Channel 2Channel 1 selecting /megajukebox/demotunes/track_1.mp3Channel 2 selecting /megajukebox/demotunes/track_1.mp3Playing track_1.mp3searching for Id3v2searching for Id3v1copying the datafixing the nullsadding the urlclosing input fileUsing 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 aSelect prev track on channel q zStart/Stop channel 2 s

The Linux MP3−HOWTO

LiveIce 25

Page 29: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Reset channel w xIncrease volume on channel 3 dDecrease volume on channel e cIncrease speed on channel 4 fDecrease speed on channel r vSticky mode On/Random/Off 5 gPreview channel t bRandom Track u m

The above liveice.cfg is for mixermode. To use LiveIce in audio mode change the line relating to MIXER toNOMIXER 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/playlist0Initialising Soundcard16Bit 22050Hz Stereo Full Duplex opening connection to megajukebox 8000Attempting to Contact Serverconnection successful: forking processopening pipe!...writing passwordSetting up InterfaceSoundcard Reopened For EncodingInput Format: 16Bit 22050Hz StereoOutput Format: 32000 Bps Mpeg AudioIceCast Server: megajukebox:8000Mountpoint: /daves_band_live_at_the_clubName: megajukebox − Dave and the Dynamite − Live at the Roxy Genre: Live/RockUrl: http://megajukeboxDescription: megajukebox::Louder than a frog in a trashcan..... and almost as musical

Press '+' to FinishLvl: 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 isautomatically generated. If you are using the TK based GUI liveiceconfigure.tk and you've made manualchanges, you will lose them when you save. Either use the GUI or learn vi/emacs :)

The Linux MP3−HOWTO

LiveIce 26

Page 30: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 thefollowing, 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 ofJDK 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 tothis (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 [email protected] 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.cfgReading playlist: playlist.m3uServer started on port: 2711Accepting administrator login on port: 2710P| 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 demofiles!

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

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

The Linux MP3−HOWTO

11.2 Fluid 27

Page 31: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 thisthis 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 2710Trying 127.0.0.1..megajukeboxConnected to localhost.localdomain.Escape character is '^]'.jaguarYou are connected to the −Fluid− Streaming ServerType "help" for a command referencehelpThe following commands are available: help conn curr exitcurrInformation about the currently broadcasted song:Title: Beer TalkArtist: Homer SimpsonAlbum: The SimpsonsYear: 1996Comment: Borrowed this as an exampleGenre: Comedy

The reference to "jaguar" is the admin password, this is the default. There is no prompt for the password soplease don't sit there waiting for one! I suggest that you change the password from the default otherwise youwill invite a hack! This can be changed in the config file, which looks like this:

[dj@megajukebox config]$ cat MP3TX.cfg 2711271054096321000jaguarplaylist.m3ucurrent.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 Linux MP3−HOWTO

11.2 Fluid 28

Page 32: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

Update for RC1

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

Here are the main differences:

A new format fluid.config• A new default port 4711• A new method of starting and stopping. Fluid now used the scripts fluid.start and fluid.stop• Source code is now part of the dist. Yippee!•

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 domainname 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 theLitestream 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 serverto mp3 directory servers.

Here is an example:

The Linux MP3−HOWTO

Update for RC1 29

Page 33: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

[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 donewith 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 reflectthe 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 LitestreamStreaming 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 offeatures as Fluid, Litestream & Icecast.

The Linux MP3−HOWTO

11.4 Apache::MP3 Module 30

Page 34: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 madein 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 thefollowing (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 certainports 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 thesame URL or IP address.

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

The Linux MP3−HOWTO

11.5 Firewall Bypassing 31

Page 35: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

[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 at128K/Bps stereo, each connecting player will use 256K/Bps, so only 6 users could connect to your MP3server 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 internetconnection is rated at, but what your users will be connecting at. 24K/Bps Stereo will give a reasonablequality 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 yournetwork 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 ashock. Some ISP's will charge you for bandwidth over a certain limit and sys admins like to know why theirnetwork 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 theirpermission 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 beliable.

Below are two links, one for the Electronic Frontier Foundation who are advocates of freeing restrictionssurrounding the technology. The other link is to the Recording Industry Association of America, which seeksto 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 fromfile or stream.

The Linux MP3−HOWTO

11.6 Bandwidth considerations 32

Page 36: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

12.1 Playing from File

Playing from file is reasonably straight−forward with all players. The only big difference is some arecommand−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

The Linux MP3−HOWTO

12.1 Playing from File 33

Page 37: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

name: Megajukebox reponse: 200genre: Megajukebox url: http://www.megajukebox.com/bitrate: 128This stream contains no meta data, ripping as one large ass track1st track rippedsocket 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 OKLength: unspecified [audio/mpeg]

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

12.4 Mixing

The Linux MP3−HOWTO

wget 34

Page 38: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 nexttrack 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 Streamingsection.

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 suchas who the artist is, what album the track came from, and so on.

The Linux MP3−HOWTO

eMixer 35

Page 39: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

Editors allow you to view and edit this information.

13.1 id3ed

[dj@megajukebox]$ id3ed id3ed v1.10 − mpeg layer 3 file information editorUsage: 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 Demoartist[max:30]: Us album[max:30]: White Albumyear[max:4]: 1999comment[max:28]: Will be a classic some day!tracknum[max:3]: 1genre[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 Demoartist: Usalbum: White Albumyear: 1999comment: Will be a classic some day!tracknum: 1genre: 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]...

The Linux MP3−HOWTO

13.1 id3ed 36

Page 40: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 fromhttp://www.id3.org/id3v2−00.txt].

The following genres are defined in ID3v1

0.Blues

The Linux MP3−HOWTO

13.3 ID3 Genre codes 37

Page 41: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

The Linux MP3−HOWTO

13.3 ID3 Genre codes 38

Page 42: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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

The Linux MP3−HOWTO

13.3 ID3 Genre codes 39

Page 43: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

122.Drum Solo 123.A capella 124.Euro−House 125.Dance Hall

14. MP3 to Minidisc.

By Afra <[email protected]>

To record MP3s from Linux to your minidisc, there are two methods: analog and digital. Each method isdependant on the type of soundcard your Linux box has. The main difference between analog and digitalrecordings is the sound quality you achieve during recording. With an analog recording you may hear somestatic noise/fuzz, although some analog soundcards try to minimize this. Don't think that just because youhave an analog sound card that you are doomed, because you are not. This just means you will have to spenda 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 willrequire 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 analoguerecording route.

To record an MP3 from your Linux box onto your Minidisc, connect an analog chord from your sound card'sLine Out to your Minidisc's Line In input. Set your Minidisc in the recording mode as you usually would andplay the MP3. You should see the recording levels on your Minidisc rise. Upon playback, you may notice asmall 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 −3dBand 0dB range. To help clear up the noise you may hear connect up your Minidisc as described above andturn on the Recording Mode but do not play an MP3. You should still hear the noise and this may help infiddling with your mixer effects.

14.2 Digital Recording

You will experience better sound quality with digital recording. Connect your optical cable (if you have tobuy one, the sizes of the MD and card port matter, usually 3.5mm but check your soundcard and Minidiscuser 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 minidiscDigital 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 automarkwhen a track jumps onto another (ie. change track numbers automatically)? The solution is this MP3 file

The Linux MP3−HOWTO

14. MP3 to Minidisc. 40

Page 44: The Linux MP3-HOWTO - Linux Documentation ProjectFor 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

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 onyour 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 hardwareand / or software listed within this document, or can add to anything within this area, please send yourinformation for inclusion to [email protected] 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 dueto work.

Happy MP3'ing!!

The Linux MP3−HOWTO

15. Feedback. 41