YoLinux: Linux MP3

Digital music players, CD rip tools and digital encoders

This tutorial covers the playing and generation of MP3 files for use in MP3 players or with audio streaming (IceCast). This tutorial will list the most popular digital sound players as well as CD ripping and MP3 (and Ogg Vorbis, FLAC, WAV) encoding tools. Ripping and encoding covers the use of the Sound Juicer and Grip MP3 GUI rip tool as well as the command line interfaces used to generate MP3 or other digitally encoded sound files.

Related YoLinux Tutorials:

°Burn DVD on Linux

°Real Video Streaming

°Streaming MP3s

°Public Domain Music

°Integrate Linux into MS/Windows environment

°YoLinux Tutorials Index




Free Information Technology Magazines and Document Downloads
TradePub link image


Digital audio (MP3) Players:

Players:

Amarokhttp://amarok.kde.org/
Description:Feature rich KDE audio player. Available plugins include an automatic scrolling of Lyrics. Supports M3U playlists.
From the GNOME toolbar: Applications -> Sound & Video -> Amarok
Formats:MP3, WMA, Real, Ogg, AAC, FLAC, ALAC (Apple), SHN, WAV. Also optical audio CD.
Installation:Debian/Ubuntu: sudo apt-get install amarok
If KDE is not yet installed, it will be when as this application is dependent upon Qt and KDE.
Linux MP3 player: Amarok

Audacioushttp://audacious-media-player.org/
Description:Feature rich audio player. A Gtk2 fork and superset of beep and xmmx players. Supports M3U, PLS and XSPF playlists
From the GNOME toolbar: Applications -> Sound & Video -> Audacious
Formats:MP3, AAC, AC3, APE, ALAC (Apple), FLAC, Ogg Vorbis, WAV, Musepack, TTA, WMA, several chiptune formats, MIDI, Playstation Audio, etc. Also optical audio CD.
Installation:Debian/Ubuntu: apt-get install audacious
Red Hat EL5/Fedora 4-6 RPMs: audacious, audacious-plugins
Linux MP3 player: Audacious

Rhythmboxhttp://www.gnome.org/projects/rhythmbox
Description:Default Gnome player and jukebox. Supports PLS playlists. Based on Gnome gStreamer plugin framework.
From the GNOME toolbar: Applications -> Sound & Video -> Rhythmbox
Formats:MP3, AAC, AC3, APE, ALAC (Apple), FLAC, Ogg Vorbis, WAV, Musepack, WMA, Real. (very complete!) Also optical audio CD.
Installation:Debian/Ubuntu: apt-get install rhythmbox
Fedora/Red Hat: Included on installation media. RPM package: rhythmbox
Linux MP3 player: Rhythmbox

JuKhttp://developer.kde.org/~wheeler/juk.html
Description:KDE player and jukebox. Integrates well with toolbar.
From the GNOME toolbar: Applications -> Sound & Video -> JuK
Formats:MP3, APE, FLAC, Ogg Vorbis, Musepack. Optical CD not natively supported. Audio CD only with helper application.
Installation:Debian/Ubuntu: apt-get install juk
Fedora/Red Hat (RHEL6): Included on installation media. RPM package: kdemultimedia
Linux MP3 player: Rhythmbox

MPG123http://www.mpg123.de/
Description:Console/command line MP3 player
From the command line: mpg123 file-name.mp3
Formats:MP3
Installation:Debian/Ubuntu: apt-get install mpg123

user1@localhost:~/MP3$ mpg123 01_02_Tres_Brujas.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.12.1; written and copyright by Michael Hipp and others
	free software (LGPL/GPL) without any warranty but with best wishes

Playing MPEG stream 1 of 1: 01_02_Tres_Brujas.mp3 ...
Title:   Tres Brujas                     Artist: The Sword
Album:   Warp Riders
Year:    2010                            Genre:  Metal
MPEG 1.0 layer III, VBR, 44100 Hz joint-stereo

[4:09] Decoding of 01_02_Tres_Brujas.mp3 finished.
      
      

MPG321http://mpg321.sourceforge.net/
Description:Console/command line MP3 player
From the command line: mpg321 file-name.mp3
Formats:MP3, WAV
Installation:Debian/Ubuntu: apt-get install mpg321

user1@localhost:~/MP3$ mpg321 Slacktone_-_The_Bells_of_St_Kahuna_Live__KEXP.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.2.12-1 (2010/07/01). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Title	: The Bells of St. Kahuna (Live  Artist : Slacktone                     
Album	: Slacktone - Live @ KEXP 9/23/2 Year	 : 2011
Comment : URL: http://freemusicarchive.o Genre : rock                          

Playing MPEG stream from Slacktone_-_The_Bells_of_St_Kahuna_Live__KEXP.mp3 ...
MPEG 1.0 layer III, 320 kbit/s, 44100 Hz joint-stereo

[4:30] Decoding of Slacktone_-_The_Bells_of_St_Kahuna_Live__KEXP.mp3 finished.
      
      

Additional Digital Audio Players:

  • Alsa
  • Banshee - Gnome media player (CDs, audio books, Podcasts, Radio, Videos, ...)
  • Exaile - Python/Gtk+ full featured player
  • Muine Gnome
  • MPlayer - (not just a video player)
  • XMMS.org - 4Front Multimedia
    Note: Typing the letter 'l' will open a dialog box which will allow you to select a new file.
    Use as GUI or command line: xmms file-name.mp3

[Potential Pitfall]: Many of the audio players require an internet connection to connect to music information repositories on the internet. Gnome based applications will require one to set the GNOME proxy configuration if your LAN is behind a corporate proxy. See GNOME proxy configuration to set this configuration for the GNOME desktop and GNOME applications.

Links:


Linux MP3 ripping and encoding tools:

NameCommentsGUICDDAMP3OggFLACWAV
Sound JuicerCurrent Gnome CD ripper
Connects to MusicBrainz.com for CD and track information.
YYYYYY
Gripdepricated Gnome CD ripperYNYYYY
KaudioCreatorKDE desktop ripper/encoder. Configure with KDE Control Center (kcontrol)
System Setings -> Sound and Multimedia -> Audio CD
YYYYYY
CD ParanoiaCommand line CD to WAV,AIFF,AIFF-CNNNNNY
RipperXSupports CDDB lookups.
apt-get install ripperx
YNYYYY
Ruby RipperUses CDDB-info.
Install: apt-get install rubyripper rubyripper-gtk
Dependencies: cd-discid cdparanoia flac lame mp3gain normalize-audio ruby-gnome2 ruby vorbisgain
YNYYYY
MP3cMP3 creator - X-11 and console program - connects to the CDDB databaseYNYYNN

Audio Formats:

  • MP3: patented format. Lossy data compression.
  • Ogg Vorbis: lossy open audio format
    Vorbis.com
  • FLAC: Free Lossless Audio Codec. Non-proprietary, unencumbered by patents
    flac.sourceforge.net
  • AAC: Advanced Audio Coding. Apple iPod format. Patented. A patent license is required for all manufacturers or developers of AAC codecs. Thus FOSS implementations such as FFmpeg and FAAC may be distributed in source form only, in order to avoid patent infringement.
  • WAV:
  • CDDA: Compact Disk Digital Audio. Raw compact disc format.
    flac.sourceforge.net

Wikipedia comparison of audio formats

Digital Audio Encoders:

The encoder takes the raw digital musc representation and converts it to the compressed format desired.

NameCommentsOutput
LAMELAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL. MP3
Fraunhofer technology licensed by Technicolor
MP3HD
Commercially available mp3HD command line encoder for Linux.MP3
BladeEncBladeEnc is a fast freeware MP3 encoder. Homepage no longer available. MP3
MP+Designed to maintain the same level of quality as the original WAV file. MP3
Ogg VorbisOpen, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for high quality (44.1-48.0kHz, 16+ bit, polyphonic) autdio. ogg
FAACAdvanced Audio Coder (MPEG2-AAC, MPEG4-AAC).. AAC
FLACcommand line encoder: source
commands
FLAC
FraunhoferLGPL. MP3


Sound Juicer: Creating MP3, OGG, FLAC files from an audio CD

Sound Juicer is the current (Fedora 4+) Linux Gnome desktop audio CD riping and encoding tool.
Launch application: Applications + Sound and Video... + Audio CD Extractor

Due to licensing issues, MP3 encoding is not installed by default. Encoding available with the base Linux distributions include Ogg Vorbis and WAV. See instructions below to add MP3 encoding capability.

Installation:
  • Red Hat/Fedora/CentOS:
    • The sound-juicer RPM is included in the DVD ISO images and can be installed during installation or afterwards from the DVD.
      or
    • yum install sound-juicer
  • Ubuntu: apt-get install sound-juicer

Sound Juicer configuration:

The digital encoders used by Sound Juicer are configured using the "Gnome Audio Profiles" tool.

/usr/bin/gnome-audio-profiles-properties
(RPM package: gnome-media)


Be sure to check "Active" to make this available.
Gnome GUI configuration tool Gnome GUI configuration tool
Select "New" and enter "Profile name".

Gnome GUI configuration tool
EnterGstreamer encoding parameters. See below.

MP3 encoding parameters:

Profile NameGstreamer pipelingFile extension
Mp3 - Lossyaudio/x-raw-int,rate=44100,channels=2 ! lame name=encmp3
Mp3 - High Quality (Lame)audio/x-raw-int,rate=44100,channels=2 ! lame name=enc vbr=4 vbr-quality=2mp3
Mp3 - Portableaudio/x-raw-int,rate=44100,channels=2 ! lame name=enc vbr=4 vbr-quality=6mp3
Ogg Quality, Lossyaudio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.5 ! oggmuxogg
WAV Voice, Losslessaudio/x-raw-int,rate=22050,channels=1 ! wavenc name=encwav

Ripping and encoding:

Once encoder profiles have been configured, start Sound Juicer: Applications + Sound and Video... + Audio CD Extractor

Gnome GUI CD ripping and encoding tool
Set destination "Folder".
Set preferences by selecting encoder.

Gnome GUI CD ripping and encoding tool
Put CD in tray. Sound Juicer will attempt to identify the Title, Artist, Tracks, etc from MusicBrainz.com. If not you get this display.

[Potential Pitfall]: This feature requires an internet connection to connect to the music information repository at MusicBrainz.com. One must set the GNOME proxy configuration if your LAN is behind a corporate proxy. See GNOME proxy configuration to set this configuration for the GNOME desktop and GNOME applications.

Select "Extract" to "Rip" and encode! Sound Juicer rings a bell when done.



Sound Juicer can also duplicate audio CDs.

Gnome GUI CD ripping and encoding tool


Adding MP3 encoding capability to Sound Juicer:

Red Hat, Fedora, CentOS, Suse and Mandrake RPM based Linux distributions:

In order to encode to MP3 one must install the MP3 encoder which is not available with either the default Ubuntu or Red Hat distributions. Red Hat, Fedora, CentOS, Suse and Mandrake RPM based Linux distributions will require the installation of the gstreamer-plugins-ugly RPM package. The available encoder configurations can be seen or modified with gnome-audio-profiles-properties.

The gstreamer-plugins-ugly RPM and dependencies can be found at http://rpm.pbone.net/

  • Package: gstreamer-plugins-ugly
    Provides:
    • gstreamer-a52dec
    • gstreamer-dvdread
    • gstreamer-lame
    • gstreamer-mad
    • gstreamer-mpeg2dec
    • gstreamer-sid
  • Package: libmp3lame
    Provides: libmp3lame.so.0
  • Package: libmpeg2
    Provides: libmpeg2.so.0
  • Package: liba52
    Provides: liba52.so.0
  • Package: twolame
    Provides: libtwolame.so.0
  • Package: libid3tag
    Provides: libid3tag.so.0
  • Package: libopencore-amrwb
    Provides: libopencore-amrwb.so.0
  • Package: libopencore-amrnb
    Provides: libopencore-amrnb.so.0
  • Package: libsidplay
    Provides: libsidplay.so.1
  • Package: libmad
    Provides: libmad.so.0
  • Package: libx264_112
    Provides: libx264.so.112
Example: The installation of MP3 supplemental packages on my Red Hat 6 Enterprise Linux (64 bit) Workstation:
rpm -ivh gstreamer-plugins-ugly-0.10.17-13.el6.x86_64.rpm libmp3lame0-3.98.4-22.el6.x86_64.rpm libmpeg2_0-0.5.1-5.el6.x86_64.rpm liba52_0-0.7.4-7.0.1.el6.x86_64.rpm twolame-0.3.12-2.el6.x86_64.rpm libid3tag-0.15.1b-7.el6.x86_64.rpm libopencore-amrwb0-0.1.2-2.el6.x86_64.rpm libsidplay-1.36.59-1.2.fc6.rf.x86_64.rpm libmad0-0.15.1b-4.el6.x86_64.rpm libopencore-amrnb0-0.1.2-2.el6.x86_64.rpm libx264_112-0.112-14_20110114.2245.el6.x86_64.rpm

Debian/Ubuntu: 11.04

Options:
  • Open Source Solution: Installation: apt-get install gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse

  • Commercial Solution: Fluendo (Fluendo is a company specialized in delivering licensed products for Unix and Linux multimedia.)

    Use the "Ubunto Software Center" to download and install the Fluendo MP3 codecs.
    Ubuntu Software Center Fluendo: MP3 codec installation
    This installs package: gstreamer0.10-fluendo-mp3
Choose only one of the above two options. The two can not co-exist.


Selection of encoders for Sound Juicer
Selection of encoders for Sound Juicer.


GRIP: Creating MP3 files from a CD

Note that Grip is no longer the default Gnome CD ripper. Grip has been replaced by Sound Juicer.

Grip is available in RPM form with Fedora Core (1,2,3) and Red Hat distributions. On older Red Hat 7 releases, it was available on the Red Hat Powertools CD The source is available from the Grip home page. This GUI is a front-end to Linux command line tools. It utilizes cdparanoia (cdparanoia is actually built into Grip or you can use the external cdparanoia command) or cdda2wav (my choice) for CD "ripping" and lame (best choice), bladeenc, mp3encode, gogo, xingmp3enc or l3enc to encode the MP3 file. Set the appropriate options under the "Config" tab. Grip also has a built-in CD player (GCD) and connects to CDDB (freedb.freedb.org) to obtain track titles where available.

Installation:
  • Red Hat/Fedora/CentOS: yum install grip
  • Ubuntu: apt-get install grip

Usage:

  • # Install MP3 encoder (detailed below): # Download lame source and compile (detailed below). (or bladeenc)
  • Start Grip: /usr/bin/grip
  • Configure Grip:
    • Select "Config" + "MP3" (or "Encode") + "Encoder" tabs.
      • Set the "Encoder" pull down menu to "lame" or "bladeenc"
      • Set the MP3 encoder: /opt/bin/lame or /opt/bin/bladeenc
        (Note: Fedora Core comes with lame and Grip is pre-configured.)
      • Default file format: ~/mp3/%a/%d/%n.mp3
        This will put the ripped and encoded MP3 files into the directory/file: $HOME/mp3/Artist-name/Disc-title/Track-name.mp3
  • Select tracks to convert. Select the "Tracks" tab and select the tracks with the middle mouse button (three button mouse or two at once for a two button mouse).
  • Select the "Rip" tab + "Rip+Encde" button to begin.
Note: Grip will also generate a playlist (.m3u file) of the tracks converted and put it in your $HOME/mp3/ directory.

Configure Select Tracks
Rip


Creating MP3 files from a CD: - Using the command line -

It is easiest to use the GUI tool Grip as described above. You may choose to use the command line interface as detailed here:

Dump tracks on an audio CD to wav files on your hard drive:

cdda2wav -D 0,4,0 -B /tmp/prefix-of-music-file
          
The files will be written out as /tmp/prefix-of-music-file_01.inf /tmp/prefix-of-music-file_01.wav /tmp/prefix-of-music-file_02.inf ...

You may have to be root. See YoLinux managing groups tutorial to configure system for regular users with CD-ROM access.

Encode MP3: Convert WAV to MP3

Use one of the following encoders:

  • Lame:
    lame prefix-of-music-file_01.wav  song.mp3          - Fixed 128kbs stereo encoding
    lame -h prefix-of-music-file_01.wav  song.mp3       - High quality
    lame -f prefix-of-music-file_01.wav  song.mp3       - Fast and low quality
    lame -b 112 prefix-of-music-file_01.wav  song.mp3   - Encode at a bit rate of 112 kbs
                  
    Type lame --help to see file "USAGE" and get list of command line options.

    Installation:

    • Ubuntu: sudo apt-get install lame

    Man pages:

    Use mlame script to convert multiple wav files.
    ./mlame -r -o "-v -V 0 -b 112" a*.wav

    mlame Options:

    • -h: help text
    • -r: remove files after encoding
    • -o: "<lame options>" overrides script default options "-h -d -m j -b 128"

    OR

  • Bladeenc:
    bladeenc prefix-of-music-file_01.wav  song.mp3

Note: The size of the MP3 file will be approximately 10% the size of the wav file.


MP3 encoders

I was e-mailed the following tip: "Found that the BladeEnc MP3 encoder works better (for my ears) encoding NewAge/Classical/etc and that lame is better for harder music genres." Judge for yourself.

One may notice that the MP3 encoders are often missing from Linux distributions. The reason is that since 1998, the German research lab that holds the MP3 patent, Fraunhofer, imposes fees to license and distribute the encoder. This may lead to the eventual rise of Ogg Vorbis as a standard format although the recording industry rejects it due to the lack of anti-piracy mechanisms.


Building Lame: (MP3 encoder)

The "lame" command line MP3 encoder is used in the conversion of wav files (and other formats) to the MP3 file format.

The "lame" encoder RPMs currently ships with the Fedora Core. If you wish to build the latest:

  • The Lame home page: http://lame.sourceforge.net/
  • tar -xzf lame3.70.tar.gz
  • cd lame-3.70
  • make
  • mv lame /opt/bin
  • mv mlame /opt/bin (Script to handle multiple files)
  • mv auenc /opt/bin (Script to handle multiple files)
  • mv doc/man/lame.1 /opt/man/man1
  • mv doc/html /usr/share/doc/lame/ (or on older systems: /usr/doc/lame) - Linux doc location


Building BladeEnc: (MP3 encoder)

The "bladeenc" command line MP3 encoder is used in the conversion of wav files to the MP3 file format.

  • Download source from the BladeEnc home page: http://home8.swipnet.se/~w-82625/default.htm
  • Click on "Sourcecode" (left frame)
  • tar -xzf bladeenc-0.9x.x-src-stable.tar.gz
  • cd bladeenc-0.9x.x
  • ./configure --prefix=/opt
  • make
  • make install


Links:

   

    Bookmark and Share


Advertisements




Copyright © 2001 - 2014 by Greg Ippolito