This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

CLI Magic: Playing music from the command line with mp3blaster

By Shashank Sharma on March 27, 2006 (9:00:00 AM)

Share    Print    Comments   

Ever since my first Linux install 10 years ago, I have been hooked on the command line. The Bourne Again Shell (BASH) has been my first choice for moving or copying files, writing text, browsing through my home folder, and lately, even for reading email. When I realized I was depending on graphical players to listen to my MP3 collection, I searched for a command-line MP3 player -- and found mp3blaster.

In addition to MP3 files, mp3blaster can play Ogg and WAV files. The most intriguing things about mp3blaster are its user interface and its ability to make groups within playlists.

Getting started

mp3blaster's highly customizable UI is designed in ncurses, a programming library that allows developers to create text-based interfaces for command-line programs. The ncurses-based interface makes mp3blaster similar to graphical music players, in that there are play, stop, forward, and other buttons. The screen is divided into well-marked boxes. At the top of the screen is a box that lists all the program's keybindings. To browse through all the keybindings, press the plus (+) key to move from page to page.

The box on the right lists the buttons to do routine tasks such as pause, forward, rewind, and play previous track. Each button also has a symbol above it that makes it easier to deduce what the button does what. For example, pressing 6 (>|) makes mp3blaster jump to the next track in your playlist, while pressing 3 (>>) fast-forwards the track.

A simple mp3blaster at the terminal launches mp3blaster and lets you create a playlist. The default keybinding to add files is F1. While this is fine if you run mp3blaster from a text console, most desktop environments have this key mapped to launch the help window, so I suggest you modify the keybindings if you wish to run mp3blaster in X. To do this, copy the sample.mp3blasterrc file from the /usr/share/doc/mp3blaster/example/ directory to your home directory and rename it to .mp3blasterrc; cp /usr/share/doc/mp3blaster/example/sample.mp3blasterrc ~/.mp3blasterrc should do the trick.

Next, edit the .mp3blasterrc file. All the lines in the file are commented out. Scroll down to the section titled keybindings, and uncomment the line #Key.SelectFiles = 1 by removing the # character from the beginning of the line. If you wish to use some other key to add files, replace the 1 after the "=" sign with your key of choice.

Creating playlists

mp3blaster playlist You should use the keybindings menu to create playlists to start, as it takes some time getting acquainted with the keys. Press your Select Files button to open a menu you can use to browse to the directory where you keep your music files. Pressing the Recurs. Select All button adds all the files in the directory to the playlist, as well as files from any subdirectories that mp3blaster finds.

Mp3blaster allows you to create groups in your playlist. To do this, press the Select Files button and browse to your music directory, then press the Add Dirs As Groups" button to create groups in your playlist for each subdirectory.

Each group can have its own shuffle property, meaning you can restrict random song selection to only songs in a single group. If you toggle the shuffle property to "on" from the main playlist, mp3blaster will shuffle songs from all the groups.

Conclusion

The only thing I find lacking in mp3blaster is a jump-to location option. I felt the need for it when, while listening to a two-hour track, I had to jump to the point at 1:15:00. I found the 10-second jump provided by the forward button was too little for this task, as I would have had to keep the forward key pressed for a long time. I solved the problem by modifying the #SkipLength = 10 line from .mp3blasterrc file. A jump-to location option is on the project's TODO list, but until it comes out, modifying the forward time is the best thing to do.

Shashank Sharma is studying for a degree in computer science. He specializes in writing about free and open source software for new users.

Shashank Sharma specializes in writing about free and open source software for new users and moderates the Linux.com forum boards. He is the coauthor of Beginning Fedora, published by Apress.

Share    Print    Comments   

Comments

on CLI Magic: Playing music from the command line with mp3blaster

Note: Comments are owned by the poster. We are not responsible for their content.

I agree, mp3blaster is great!

Posted by: Anonymous Coward on March 28, 2006 01:59 AM
I always use it at the odd times I'm in 'CLI' mode, e.g. when installing the nvidia drivers from source. I always like music playing in the background.

#

good options

Posted by: Anonymous Coward on March 28, 2006 03:56 AM
try ogg123 - also CLI & plays free

#

Re:good options

Posted by: Anonymous Coward on March 28, 2006 09:50 PM
know about it. I also use mpg123, or what's it called?

#

ALSA not OSS

Posted by: Anonymous Coward on March 27, 2006 08:34 PM
I've not visited mp3blasters homepage so I wouldn't know if it's on the TODO-list. But I think that sticking to OSS is bad. Go for ALSA. It's the real thing.

I did actually put a request on forum for mp3blaster.

#

Re:ALSA not OSS

Posted by: Anonymous Coward on March 28, 2006 08:14 AM
I hope they will find time to do so, this way I will be able to listen my music and play zsnes with sound<nobr> <wbr></nobr>:)

#

Pain

Posted by: Anonymous Coward on May 28, 2006 02:17 PM
<tt>[URL=http://painrelief.fanspace.com/index.htm] Pain relief [/URL]
[URL=http://lowerbackpain.0pi.com/backpain.htm] Back Pain [/URL]
[URL=http://painreliefproduct.guildspace.com] Pain relief [/URL]
[URL=http://painreliefmedic.friendpages.c<nobr>o<wbr></nobr> m] Pain relief [/URL]
[URL=http://nervepainrelief.jeeran.com/pa<nobr>i<wbr></nobr> nrelief.htm] Nerve pain relief [/URL]</tt>

#

not commandline

Posted by: Anonymous Coward on March 27, 2006 11:57 PM
mp3blaster is not for the command line, it's a console application (it uses ncurses instead of printf).

Personally I find its interface a little difficult. Never invested enough time to figure out how those playlists work (and I guess they are not following a standardized format anyhow). "music123 -z -r<nobr> <wbr></nobr>/MUSIC" does the trick for me already...<nobr> <wbr></nobr>;)

#

Re:not commandline

Posted by: Anonymous Coward on March 29, 2006 01:57 PM
Thank you! I came blazing in here to say just that and found you'd already done it. console != cli.

And I agree, mp3blaster's UI is a bit awkward. Still one of the coolest console players. But I've given it over for mpd, which has CLI, console, and GUI interfaces, though its future is a bit hazy.

#

mocp

Posted by: Anonymous Coward on March 28, 2006 12:56 AM
Try mocp, you'd like too<nobr> <wbr></nobr>:)

<a href="http://moc.daper.net/" title="daper.net">http://moc.daper.net/</a daper.net>

#

Also...

Posted by: Anonymous Coward on March 28, 2006 04:24 AM
I'm sure there are many such players one can suggest but try Cmus, you will not be displeased. It it more than a player, it is a whole jukebox like thing for the console! The latest version features 3 different views, easily searchable playlists, and convenient keybinds. Perhaps the best feature is the ability to change bindings and settings at will, within the player itself, through vi-style commands (with tab completion too!). Through the same mechanism, it solves the problem this author had by having a<nobr> <wbr></nobr>:seek +time feature.

In addition to OSS (according to it's webpage) it also supports Alsa, libao, arts, and sun.

There are many more features which I will not mention in the interest of brevity, but I highly encourage each of you to try out this free player for yourself.

<a href="http://onion.dynserv.net/~timo/cmus.html" title="dynserv.net">http://onion.dynserv.net/~timo/cmus.html</a dynserv.net>
<a href="http://freshmeat.net/projects/cmus/" title="freshmeat.net">http://freshmeat.net/projects/cmus/</a freshmeat.net>

#

I use mpd

Posted by: Anonymous Coward on March 28, 2006 06:29 AM
Have you tried mpd?
<a href="http://www.musicpd.org/" title="musicpd.org">http://www.musicpd.org/</a musicpd.org>
I like it a lot

#

Re:I use mpd

Posted by: Anonymous Coward on March 28, 2006 11:34 PM
MPD is great, alas its a server that can be controlled remotely from a client anywhere on the network.

Clients are available in both console/graphical/web/write-your-own incarnations.

Mikkel,

#

Duhuduhuhud

Posted by: Anonymous Coward on March 28, 2006 04:13 PM
There is a console based music player called C*Mus that use ncurses.
* <a href="http://freshmeat.net/projects/cmus/" title="freshmeat.net">http://freshmeat.net/projects/cmus/</a freshmeat.net>
* <a href="http://freshmeat.net/redir/cmus/50952/url_homepage/cmus.html" title="freshmeat.net">http://freshmeat.net/redir/cmus/50952/url_homepag<nobr>e<wbr></nobr> /cmus.html</a freshmeat.net>

And a command line (CLI) based music player for the consoler called ogg123.
* <a href="http://en.wikipedia.org/wiki/Ogg123" title="wikipedia.org">http://en.wikipedia.org/wiki/Ogg123</a wikipedia.org>

#

Re:mplayer

Posted by: Anonymous Coward on March 28, 2006 05:37 PM
Love using mplayer for music. I have an old notebook in the living room running headless (broken LCD) and operating as a jukebox. I use mplayer to play internet radio.

eg.
mplayer -playlist <a href="http://radio.grassyhill.org/listen.pls" title="grassyhill.org">http://radio.grassyhill.org/listen.pls</a grassyhill.org>

mplayer -playlist <a href="http://somafm.com/indiepop.pls" title="somafm.com">http://somafm.com/indiepop.pls</a somafm.com>

# digitallyimported
mplayer <a href="http://64.236.34.196/stream/1065" title="64.236.34.196">http://64.236.34.196/stream/1065</a 64.236.34.196>

#

Re:mplayer

Posted by: Administrator on March 29, 2006 12:26 AM
I, too, love mplayer. I used to have to use windows for music and video but not any more. The playing music on remote machines is an awsome feature. One of the most useful peices of software I have picked up in the last week.

#

mplayer

Posted by: Administrator on March 28, 2006 01:34 AM
Any one use mplayer?

It plays video and music; for music it is a command line app; however, if you play video it opens up a window. So far its played just about everthing I have given it. It is controlled by keys which is pretty nice.

Kibun

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya