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? Yes! 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 (http://www.xmms.org/) and Beep Media Player (http://beepmp.sourceforge.net/).
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.
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 at http://www.luminal.org/wiki/index.php/IMMS. 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
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 (http://imfavorites.sourceforge.net), 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 (see ).
Figure 1. IMFavorites in action
A lot of the flexibility of IMMS comes from the fact that it is based around an embedded SQL database—SQLite (http://www.sqlite.org). 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'<your query>'
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. Also refer to the description of query language understood by SQLite at http://www.hwaci.com/sw/sqlite/lang.html.
—Michael "mag" Grigoriev