This section describes some MP3 players available for FreeBSD, how to rip audio CD tracks, and how to encode and decode MP3s.
A popular graphical MP3 player is XMMS. It supports Winamp skins and additional plugins. The interface is intuitive, with a playlist, graphic equalizer, and more. Those familiar with Winamp will find XMMS simple to use. On FreeBSD, XMMS can be installed from the multimedia/xmms port or package.
The audio/mpg123 package or port provides an alternative, command-line MP3 player. Once installed, specify the MP3 file to play on the command line. If the system has multiple audio devices, the sound device can also be specifed:
mpg123High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.18.1; written and copyright by Michael Hipp and others free software (LGPL) without any warranty but with best wishes Playing MPEG stream from Foobar-GreatestHits.mp3 ... MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo
-a /dev/dsp1.0 Foobar-GreatestHits.mp3
Additional MP3 players are available in the FreeBSD Ports Collection.
Before encoding a CD or CD track to MP3, the audio data on the CD must be ripped to the hard drive. This is done by copying the raw CD Digital Audio (CDDA) data to WAV files.
cdda2wav tool, which is installed
with the sysutils/cdrtools suite, can be
used to rip audio information from
With the audio CD in the drive, the
following command can be issued as
root to rip an
entire CD into individual, per track,
In this example, the
the SCSI device
containing the CD to rip. Use
cdrecord -scanbus to determine the correct
device parameters for the system.
To rip individual tracks, use
specify the track:
To rip a range of tracks, such as track one to seven, specify a range:
To rip from an ATAPI (IDE) CDROM drive, specify the device name in place of the SCSI unit numbers. For example, to rip track 7 from an IDE drive:
/dev/acd0 -t 7
dd can be used to extract
audio tracks on ATAPI drives, as described
in Section17.5.5, “Duplicating Audio CDs”.
Lame is a popular MP3 encoder which can be installed from the audio/lame port. Due to patent issues, a package is not available.
The following command will convert the ripped
lame -h -b
Foo Song Title" --ta "
FooBar Artist" --tl "
FooBar Album" \ --ty "
2014" --tc "
Ripped and encoded by Foo" --tg "
The specified 128kbits is a standard
MP3 bitrate while the 160 and 192 bitrates
provide higher quality. The higher the bitrate, the larger
the size of the resulting MP3. The
-h turns on the
“higher quality but a little slower”
mode. The options beginning with
indicate ID3 tags, which usually contain
song information, to be embedded within the
MP3 file. Additional encoding options can
be found in the lame manual
In order to burn an audio CD from MP3s, they must first be converted to a non-compressed file format. XMMS can be used to convert to the WAV format, while mpg123 can be used to convert to the raw Pulse-Code Modulation (PCM) audio data format.
mpg123, specify the name of the
To use XMMS to convert a MP3 to WAV format, use these steps:
Right-click the window to bring up the XMMS menu.
Change the Output Plugin to “Disk Writer Plugin”.
Enter or browse to a directory to write the uncompressed files to.
Load the MP3 file into XMMS as usual, with volume at 100% and EQ settings turned off.
Play. The XMMS will appear as if it is playing the MP3, but no music will be heard. It is actually playing the MP3 to a file.
When finished, be sure to set the default Output Plugin back to what it was before in order to listen to MP3s again.
Both the WAV and PCM formats can be used with cdrecord. When using WAV files, there will be a small tick sound at the beginning of each track. This sound is the header of the WAV file. The audio/sox port or package can be used to remove the header:
sox -t wav -r 44100 -s -w -c 2
Refer to Section17.5, “Creating and Using CD Media” for more information on using a CD burner in FreeBSD.