Adding MP3 Support to Gnome
The Gnome Desktop Environment for Linux and other Unix-like operating systems has evolved quickly over the last several releases. The design philosophy behind Gnome follows various Human Interface and Usability guidelines that have drawn a great deal of criticism. This criticism stems from the decision to design the Gnome interface to allow new users to work while giving more experienced users the power and control they demand. This approach results in software that is easy-to-use but access to more advanced features often appears to be missing.
Gstreamer and Gnome
Gstreamer is an open source multimedia framework which is gaining momentum in both the Gnome and KDE communities. Gstreamer provides a foundation upon which to build software such as media players and video editors. Sound Juicer uses gstreamer plugins for ripping CDs and converting the output to various file formats and recent releases of Gnome have included support for ripping CDs to flac, ogg vorbis and wav formats. This is fine for most users however if you happen to have one of the more popular portable media players or want to take your music collection with you in your car you probably need the ripped files to be in mp3 format.
For this tutorial it is assumed you have at least the 2.8.0 release of Gnome installed. Depending on your choice of distribution you may or may not have the necessary gstreamer plugin already installed to rip mp3s. One way to check is to open a terminal window and enter the following command: gst-inspect | grep mp3
If you have the correct plugin installed you should see output similar to below:
typefindfunctions: application/x-id3: mp3, mp2, mp1, mpga, ogg, flac, tta
typefindfunctions: audio/mpeg: mp3, mp2, mp1, mpga
mpegaudioparse: mp3parse: MPEG1 Audio Parser
mpegaudio: mpegaudio:mpegaudio mp3 encoder
lame: lame: L.A.M.E. mp3 encoder
mad: mad: mad mp3 decoder
If you do not see this output you need to install the gstreamer lame plugin as well as any supporting libraries. On a Ubuntu Breezy Badger system the plugin you need is called gstreamer0.8-lame. The supporting package liblame0 is installed along with gstreamer0.8-lame. If you are not sure which packages you need to install consult the documentation for your favorite package manager.
Adding a Profile
With the proper software installed we can now focus on our attention to adding mp3 support to Gnome for use Sound Juicer. The way this is done is by adding a new audio profile to Gnome. Unfortunately accessing the program to accomplish this, gnome-audio-profiles-properties, is not plainly obvious. The quickest and easiest way to access this program is through SoundJuicer itself. Access the SoundJuicer properties window by clicking in the "Edit" menu and selecting "Preferences." From here clicking on the "Edit Profiles" button in the lower right hand corner will launch gnome-audio-profiles-properties where we will add our new profile for MP3 support.
Adding a new profile is as simple as clicking on the "New" button, entering a name and then clicking on "Create." Additional steps are required to make this profile usable. With the "Edit GMAudio Profiles" window select the newly created MP3 profile and click on "Edit." The resulting window has four fields and a checkbox. For now we'll focus on the "Gstreamer Pipeline" field.
Building a Pipeline
In order to convert audio ripped from CDs to MP3 format a pipeline has to be built that tells gstreamer which plugin to use. There are two basic pieces to a pipeline. The first part is made up of options to pass to the gstreamer audio sink and includes the type of media, the sample frequency and the number of audio channels. The second part of the pipeline selects the gstreamer plugin used to encode or decode the media and the options to pass to that encoder or decoder to control audio quality among other things. For instance, if you want to add a pipeline to create 160kbps stereo MP3s we would use a Gstreamer pipeline like below:
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=0 bitrate=160
This will result in your mp3s being encoded at 160kbps in true stereo. If you prefer using variable bitrate mp3s then you would want to use a pipeline such as this:
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=0 vbr-quality=6
MP3s encoded using this pipeline will have a variable bitrate between 128kbps and 256kbps in true stereo. If you wanted a higher variable bitrate you would change vbr-quality=6 to read vbr-quality=4 for instance. These are only simple examples. If you want more details on the options available via the gstreamer lame plugin enter gst-inspect lame | less in a terminal window.
The information provided in this howto extends to formats other than mp3. You could create a profile to encode to aac format or you could create multiple mp3 and ogg profiles depending on the content you are encoding. The important part is knowing where to look and what changes to make. The current state of Gstreamer documentation makes this somewhat difficult and this howto is meant to point you in the right direction. The information in this howto can be used with any Gnome application that accesses the gstreamer framework which offers a great deal of flexibility. A more complete list of applications that use Gstreamer can be found at http://gstreamer.freedesktop.org/apps/.
LinksGnome Desktop Environtment
Gnome Human Interface Guidelines
Gnome Usability Guidelines
K Desktop Environment