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

Linux.com

Feature: Open Source

Shuffle your music the smart way

By Michael Grigoriev on February 14, 2006 (8:00:00 AM)

Share    Print    Comments   

Think of all the ways you interact with a computer each day. Any action you take, or even don't take, conveys some meaning. For example, when listening to your music collection, you might sometimes skip songs. What does that mean? There are a number of possibilities. Maybe you do not like the song that was playing, or it does not suit your current mood, or, possibly, you've listened to this song too much and would rather it be played less often. Is it possible to build a system that uses this information to learn which music you prefer and play it more often?

This article is excerpted from Linux Multimedia Hacks, by Kyle Rankin. Copyright © 2006, O'Reilly Media, Inc. All rights reserved.

Intelligent Multimedia Management System (IMMS) is an attempt to create such a system -- an adaptive playlist framework that tracks your listening patterns and dynamically adapts to suit your personal music tastes. Plug-ins are currently available for two popular Linux media players: XMMS and Beep Media Player.

The main feature of IMMS is its complete transparency to the user. It is incredibly unobtrusive -- you never have to interact with IMMS directly. Just continue using your player as usual and, over time, IMMS will influence the song selection to cater to your preferences. When your music player chooses the next "random" track in shuffle mode, IMMS weights its choice, based on which songs you've played and which songs you've skipped previously.

IMMS also offers a number of features beyond basic rating. For example, it keeps track of when a song was played last and makes sure the same song does not repeat too often -- a common complaint with traditional shuffle-based systems. Moreover, it is able to recognize different versions of the same songs (for example remixes) and treat them as the same song.

IMMS also learns which songs should be played together and which should not. It does so by both watching and learning from the user, and performing acoustic analysis on the actual songs to determine their tempo and spectral "color," and then attempts to group more similar songs together.

Get IMMS

Depending on the distribution you use, there may already be an IMMS package available to install. There is an up-to-date Debian package for IMMS, as well as a Gentoo ebuild. If you are unable to find a pre-packaged version of IMMS, you can easily build one from source. The tarball can be downloaded from the IMMS homepage. A list of required dependencies and instructions on building IMMS are included with the source in an INSTALL file.

Once you have IMMS installed, you will need to enable it in XMMS. Open the Preferences dialog, go to the General plug-in category, select IMMS, and click the "Enable plugin" checkbox in the lower-right corner.

That's it. From now on your music player will be imbued with IMMS intelligence. You will notice that music selection will improve over time without your having to do anything at all. Of course, you should not expect this to happen overnight. It will take time for IMMS to learn your preferences. You may find IMMS to be a little slow at first, since it needs to read the tags and calculate checksums of all your files. Depending on the size of your collection, this process should not take very long. In the meantime, type:

	$ tail–f ~/.imms/imms.log

and watch IMMS rate your music.

More IMMS Magic

Figure
Although IMMS is built from the ground up to require no direct user interaction, it is possible to do some useful things with the data it accumulates. For example, if you own a portable MP3 player, you may want to fill it with the songs IMMS has identified as your favorites. James C. Jones wrote an excellent program called IMMS Magical Favorites Collector, or IMFavorites for short, for just that purpose. Simply specify how much space your player has, and IMFavorites will create a directory of symbolic links to the gems of your collection as shown in the figure.

A lot of the flexibility of IMMS comes from the fact that it is based around an embedded SQL database -- SQLite. SQLite allows users with even a very basic knowledge of Structured Query Language to generate neat statistics and reports about their music collection and preferences. To harvest its power, you will need to use the command-line client that comes with SQLite 3.0 and above -- sqlite3. IMMS stores all of its data in .imms directory in your home directory, and the database is located in ~/.imms/imms2.db. Soto run an SQL query on it, you need to execute:


	$ sqlite3 ~/.imms/imms2.db''

Here are some queries you can use:

SELECT path FROM Identify NATURAL INNER JOIN Rating WHERE rating > 145 ;

This query will effectively generate a list of favorites, because ratings in IMMS range from 75 (really bad) to 150 (really good).

A more involved example that allows you to list the top ten artists for last month would look like this:

SELECT SUM( delta ) as sumdelta, readable FROM Journal
	NATURAL INNER JOIN Library
	NATURAL INNER JOIN Info
	NATURAL INNER JOIN Artists
	GROUP BY Artist ORDER BY sumdelta DESC LIMIT 10;

To familiarize yourself with IMMS schema, run:

    SELECT FROM sqlite master;

This lists the tables present in the database and their attributes.

Share    Print    Comments   

Comments

on Shuffle your music the smart way

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

Other software

Posted by: Anonymous Coward on February 14, 2006 10:58 PM
wxMusik
* <a href="http://musik.berlios.de/" title="berlios.de">http://musik.berlios.de/</a berlios.de>
* <a href="http://en.wikipedia.org/wiki/WxMusik" title="wikipedia.org">http://en.wikipedia.org/wiki/WxMusik</a wikipedia.org>

Also there is a software called Songbird which now only exist for Windows, but soon avaible for Linux and Mac.
* <a href="http://www.songbirdnest.com/" title="songbirdnest.com">http://www.songbirdnest.com/</a songbirdnest.com>

#

Re:Other software

Posted by: Anonymous Coward on February 15, 2006 02:22 AM
another fine piece of software targetting similar objectives is <a href="http://adam.rosi-kessel.org/weblog/free_software/code/randomplay.html" title="rosi-kessel.org">randomplay</a rosi-kessel.org>.

#

Typos in article

Posted by: Anonymous Coward on February 15, 2006 04:40 PM
1. "tail-f<nobr> <wbr></nobr>..." should be "tail -f<nobr> <wbr></nobr>..."
2. "SELECT FROM sqlite master;" should be "SELECT * FROM sqlite_master;"

#

What about Amarok?

Posted by: Anonymous Coward on February 20, 2006 12:05 AM
Amarok (<a href="http://amarok.kde.org/" title="kde.org">http://amarok.kde.org/</a kde.org>) has served me well with around 1500 music tracks. I use it with GNOME, and although it is VERY bloated it still runs fine on my AMD 2000+ with other software, like AbiWord, and when running by itself it is OK on systems around 700MHz.
I like the fullscreen playlist function of Amarok, and usually have it running on it's own workspace, while I find XMMS fine for occasional files (like trying out a free song found on the web), but it's playlist functionality, even with IMMS, is too limited for my tastes.

#

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



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya