User: Password:
|
|
Subscribe / Log in / New account

Development

Collections in the XMMS2 music player

June 13, 2007

This article was contributed by Sébastien Cevey

The number of music players on Linux has been steadily increasing lately, but while these projects have been getting more and more polished, we have yet to see revolutionary improvements in terms of user experience. Indeed, the trend has been to borrow as many features as possible from other projects, rather than questioning the reasons behind their design.

This article describes XMMS2's attempt to address long-standing limitations of music players, through its new support for Collections.

Design Rationale

I have been concerned with the state of music players for a long time. Two years ago, I wrote a Manifesto for a Better Music Player. Although my ideas have evolved since then, the general conclusions of that article still hold.

One important argument I made is that the design of a music player should focus on the users' needs, rather than on a list of well-known features. All the traditional features (playlist, media library, cover browsing, etc) and hacks (play queue, random mode, etc) stem from the needs users have for:

  • playing music non-linearly
  • searching for specific media
  • browsing their media library
  • organizing their music

Non-linear playback was first introduced in a crude form as the "random mode", directly inspired from legacy CD players. iTunes later popularized its "Party Shuffle" mode, which solved the unpredictability of playback by maintaining a queue of randomly selected songs. What we are still waiting for, though, is a smarter mode that would also take into account beat, artist similarity, or other semantic information.

Music players that are based on a media library typically provide a search feature. Unfortunately, the power of the search function is often hindered by annoyingly complex forms used to choose the fields to query. Few developers seem to have noticed the success of Google's search interface: minimalistic, but enriched by rating heuristics and a rich syntax for advanced users.

The other axis required by our ever-growing music libraries is browsing. Media library browsing is always present in some form, although mostly simplistic and uninspired. When they are not cloning iTunes genre/artist/album filters or the browsing of cover art, most music players simply present the users with the list of all their media in a plain multi-column layout. Easy to implement, but hard on the eyes for the users. Interestingly, Foobar2000 (freeware) is the only popular player to allow a rich customization of the layout, which greatly improves readability.

The lack of features that help users organize their media library contributes to the difficulty of addressing the two previous issues. In the physical world, users can arrange their CDs spatially in their own personal way (by artist, date of release, mood, etc), set a couple of albums aside for playing at a party, or highlight their latest acquisitions on a shelf. This lets them build a cognitive map of the location of items. On computer-based music players, however, they are barely provided with the possibility to create playlists, possibly dynamic, but seldom integrated well enough to be used powerfully. Even bare files have richer organizational possibilities, using directories!

The reason behind these limitations is not that they are inherently unsolvable. The truth is that a lot of effort is required to implement new approaches in any of these fields. Experimentation, either conceptual or in terms of interface, is expensive.

The Collections Concept

The goal of Collections is to address this problem by creating a common abstraction layer. Search, browsing and organization all share one property: they act on subsets of the media library. Computers are especially good at handling sets, but music players haven't really exploited that fact yet.

A collection is defined as a subset of the media library. This set of media (songs) can be dynamic, for instance "All media by Kraftwerk released prior to 1980" or "All media added to the media library last week, except those by Justin Timberlake". A static set, for instance hand-picked media selected for parties, is just a special case of dynamic sets.

Note that a collection is not merely what some players call a "Smart Playlist" (or "Dynamic Playlist"). A "Smart Playlist" is only used to play an arbitrary list of media, while a collection is a generic representation of a set of media. For instance, this includes the results of a search, a filtered view of the media library, the list of tracks from a given album, etc.

Because a collection is an abstract representation, it can be used ubiquitously throughout all the features of the music player: browsing, searching in the media library or the playlist, enqueuing, jumping, etc. A collection can also be saved on the server, thus allowing the users to organize their music and reuse their selection in homogeneous and flexible ways.

Collections for the XMMS2 player

The XMMS2 project turned out to be the perfect ground to implement collections. Unlike its popular predecessor XMMS, XMMS2 hasn't gathered much attention yet. However, it features all that you would expect from a recent music player: a media library, support for many audio formats and multiple platforms (Linux, *BSD, OS X, Windows, etc), bindings for many languages (C, C++, Ruby, Python, Perl, Java), and a friendly community open to innovation.

In addition, the player was designed according to a client-server architecture, so that the server is responsible for all the boring work (audio decoding, media library management, tag extraction, etc), while any flavor of user interface can be implemented as a client connected to the server, possibly across the network.

Collections have been implemented in XMMS2 as a student project during the Google Summer of Code 2006, and finally merged into the stable tree on May 20, 2007 as part of the DrJekyll release.

Support for collections was implemented on the server as a layer above the media library, and playlists are exposed to the clients through a collections API. This API allows clients to save collections on the server, query the media library, enqueue the content of a collection, etc. Thus, although the user interface depends on the client, the server and the clients all share the same abstract representation.

Clients are also freed from the need to generate complex SQL queries themselves; instead, they can easily build a (DBMS-agnostic) collection and the tedious query is performed by the server. In addition, a parser is provided to generate a collection from a string with an enriched search syntax.

Collections make it essentially trivial to browse and search the media library. Moreover, advanced features are either natively available or very easy to implement: iTunes-like Party Shuffle, recursive filtering (e.g. search inside the playlist), display Top 10 or never played songs, changing the equalizer settings if the playing song is in a particular collection (e.g. "Jazz Vinyl rips"), etc.

Implementation

Strictly speaking, collections are implemented as a directed acyclic graph (DAG), each node of which is a collection operator. In fact, because the structure is recursive, each node of the graph corresponds to a collection. This model was chosen to emphasize the aggregated nature of users' music collections.

Collection operators come in four different flavors:

  • set operators
  • filter operators
  • list operators
  • reference operator

The set operators take an arbitrary number of operands and returns the collection obtained by applying the corresponding set operation to them. For instance, "any music by The Beatles or any music by The Rolling Stones". Available set operators: union, intersection, complement.

The filter operators enforce conditions on properties of the media; the resulting collection only contains the media that match the filtering attributes. For instance, "all the songs with 'stairway' in their title". Available filter operators: equals, match (partial matching of strings using wildcards), larger/smaller (for numbers), has (checks whether a property is present).

The list operators are a bit special. The basic list operator (called "idlist") does not accept any operands; instead, it simply generates the collection corresponding to the custom list of media it contains. Because list operators store static, ordered lists of media, they are used as playlists in XMMS2. Available list operators: list, queue (pop songs once they have been played), Party Shuffle (takes an operand, used to randomly feed the list with new entries).

The reference operator is simply used to refer to the content of a saved collection or playlist. For instance, "all the songs released in 2007 in the Foo playlist". A reference operator is also used to refer to the whole media library (all media).

Now, let's illustrate all this with a sample collection structure: [Collection Diagram] The nodes represent collection operators, while edges simply connect operands to operators.

Here, "All Media" is a reference to the whole media library, and we use a Match operator to only keep media for which the artist has a name starting by "A" (1). We then take the union (3) of this and the content of the "Rock 90's" saved collection (2). The result is passed as an operand to a Party Shuffle operator (4), which we save under the name "Interesting" (5).

When the user plays the "Interesting" playlist, songs are popped from the list as soon as they are finished, and new songs matching the operand collection (3) are automatically enqueued, so that the list always contains at least 20 items. This is specified by the "size" attribute of the Party Shuffle. Of course, the user can also edit the playlist and add tracks to it manually.

This is only one example of collections among many. As you can see, the modular structure of collections allows virtually unlimited possibilities. As such, they have been tightly integrated both on the server and in the client API.

On the server, a dedicated module is responsible for handling collection features. When a collection is queried, it serializes the structure into an SQL query, runs it in the media library and returns the matching media, either as a list of media ids or hashes containing the requested media properties. When a collection is saved on the server, it is added to the collection DAG and kept in memory while the server is running. On shutdown, the whole DAG is serialized into the database. Note that playlists are nothing but collections, albeit restricted to list operators and saved into a dedicated namespace.

In the client API, collections introduced many important changes. First, executing raw SQL queries has been deprecated; all queries are now to be performed using collections. Collection data structures can be built either using a set of dedicated functions, or by calling the collection parser on a string given by the user. Finally, many XMMS2 methods have been extended to support collections (e.g. to enqueue media) and new methods allow clients to query, save and retrieve collections from the server.

If you want to learn more about the concept of collections, please have a look at the collections concept page on the XMMS2 wiki. For more details about the implementation, check the collections design page and the API documentation.

Adoption and future directions

Several XMMS2 clients have started offering features based on collections, including Abraca (GTK2 client) and gntxmms2 (console client). Other clients have ported search and browsing to the collections API: Esperanza (Qt4 client), gxmms2 (GTK2 client) and the official command-line interface.

Hopefully, client developers will start exploring new directions now that collections are in the main release. The XMMS2 CLI client has already been scheduled for a full rewrite.

Several improvements are also expected to address current limitations of the collections implementation. One limitation is that all collections are treated equally as media sets; if a filter is applied on a playlist, the order and duplicated items will be lost. A smarter internal distinction between lists and sets inside the DAG is in the works. An ordering collection operator could then be introduced to transform a set into an ordered list, as well as an operator to select subsequences of such lists, similarly to SQL LIMIT operation. They could be used to create a collection containing the "list of the 20 most recently added media". The SQL query generator could also be further optimized, unless we decide to replace the database backend completely.

Collections have just made it into the official XMMS2 distribution, but people already use them through features like search, Party Shuffle or groups of songs saved in the media library. They are a powerful toy for developing new features in the clients and hopefully helping users organize and use their music library.

It's an exciting time to come up with fresh ideas in the XMMS2 world, and I hope the rest of the developers in the music player community will take the time to reflect on and discuss all these questions earnestly!

Comments (19 posted)

System Applications

Database Software

PostgreSQL Weekly News

The June 10, 2007 edition of the PostgreSQL Weekly News is online with the latest PostgreSQL DBMS articles and resources.

Full Story (comments: none)

Agile Database Refactoring with Hibernate (O'Reilly)

Gilad Buzi, Kelley Glenn and Jonathan Novich discuss the process of changing data models on O'Reilly. "In this article, we will show readers how to upgrade their faulty schemas and data models without affecting existing applications or processes. By using the latest technology from Hibernate (version 3.0 and up)--along with a combination of database views, stored procedures, and standard design patterns--application developers and data architects can repair a faulty data model, one piece at a time."

Comments (none posted)

Device Drivers

LIRC 0.8.2 announced

Version 0.8.2 of LIRC, the Linux Infrared Remote Control interface, is out with support for more IR remotes and other changes.

Comments (none posted)

Mail Software

Apache SpamAssassin 3.1.9 released

Version 3.1.9 of Apache SpamAssassin has been announced. "This is a maintenance and security release of the 3.1.x branch. It is highly recommended that people upgrade to this version from 3.0.x or 3.1.x."

Full Story (comments: none)

Apache SpamAssassin 3.2.1 released

Version 3.2.1 of Apache SpamAssassin has been announced. "This is a maintenance and security release of the 3.2.x branch. It is highly recommended that people upgrade to this version from 3.2.0."

Full Story (comments: none)

Mailfromd 4.1 announced

Stable version 4.1 of Mailfromd is out. "Mailfromd is a general-purpose mail filtering daemon for Sendmail and Postfix. It is able to filter both incoming and outgoing messages using criteria of arbitrary complexity, supplied by the administrator in the form of a script file. The program interfaces with Sendmail using Milter protocol. Mailfromd provides the following basic features: flexible programming language for writing filter scripts, sender address verification, SPF, DNSBL, greylisting and whitelisting, controlling mail sending rate. "

Comments (none posted)

Networking Tools

PacketViz 0.5.0 released

Version 0.5.0 of PacketViz, a Java-based network graphing tool, has been released. "PacketViz is a general packet or interaction graphing tool that can be used in a variety of applications including: Cache coherency "protocol flow diagrams", Networking packet diagrams and Dynamic software interaction diagrams".

Comments (none posted)

Miscellaneous

announcing Allmydata-Tahoe v0.3

Version 0.3 of Allmydata-Tahoe is out. "We are pleased to announce the release of version 0.3.0 of Allmydata-Tahoe, a secure, decentralized storage grid under a free-software licence. This is the follow-up to v0.2 which was released May 2, 2007"

Full Story (comments: 1)

Desktop Applications

Audio Applications

AlsaPlayer 0.99.80-rc1 and FftScope 1.0.5 announced

Version 0.99.80-rc1 of AlsaPlayer and Version 1.0.5 of FftScope have been announced. "The main added feature in those 2 packages is a new GTK2 interface."

Full Story (comments: none)

AudioMove 1.15 released

Version 1.15 of AudioMove is available. "AudioMove is a simple, easy to use GUI-based batch audio file copy-and-conversion program. You just tell it what files to convert, what format to convert them to, and where to put the output files, and it does it."

Comments (none posted)

Jokosher 0.9 arrives

Version 0.9 of Jokosher has been released. "Jokosher is a simple yet powerful multi-track studio. With it you can create and record music, podcasts and more, all from an integrated simple environment."

Comments (none posted)

Traverso 0.40.0 Released

Version 0.40.0 of Traverso is out with a number of new capabilities. "Traverso is a cross platform multitrack audio recording and editing suite with a clean and innovative interface targeted for home and professional use."

Full Story (comments: none)

Desktop Environments

GARNOME 2.19.3 announced

Version 2.19.3 of GARNOME, the bleeding-edge GNOME distribution, is out. "We are particularly proud of all the hacking and smoke-testing that has been going on during the past couple days. New tarballs have been built and tested by various GARNOMEies as fast as we could update SVN. Once again, this early testing revealed a number of serious issues with some of the GNOME applications, a bunch of bug reports where filed, resulting in new, fixed tarballs being rolled as quickly as possible -- before the official release deadline. Our contribution to make even unstable development releases a somewhat sane place to live. Thank you, #garnome!"

Full Story (comments: none)

GNOME 2.19.3 released

Version 2.19.3 of the GNOME desktop environment has been announced. "This is our third development release on our road towards GNOME 2.20.0, which will be released in September 2007. New features are still arriving, so your mission is simple : Go download it. Go compile it. Go test it. And go hack on it, document it, translate it, fix it."

Full Story (comments: none)

GNOME Software Announcements

The following new GNOME software has been announced this week: You can find more new GNOME software releases at gnomefiles.org.

Comments (none posted)

KDE Commit-Digest (KDE.News)

The June 10, 2007 edition of the KDE Commit-Digest has been announced. The content summary says: "Umbrello gets a code generator for the D programming language. Further work in Plasma. Initial work to allow the Dolphin file view component to be embedded into Konqueror. More work in the KOrganizer Calendar and KRDC Summer of Code projects, with the start of the Icon Cache, TextTool Plugins in KOffice and Kopete Messenger update projects. Start of a Solid interface in Amarok, with breakthroughs in support for the Jamendo music service. KDevelop begins to be ported to the KDevPlatform structure..."

Comments (none posted)

HIG Hunting Season: Icons (KDE.News)

KDE.News looks at getting icons ready for KDE 4. "The great work of the Oxygen icon artists is a much discussed and anticipated part of KDE 4. The new icons now follow the freedesktop.org naming specification which makes it easier to share icons between applications of several desktop environments. In the HIG hunt this week, we will check that this work lives up to its full potential by looking for missing icons and wrong uses. Read on for more details."

Comments (none posted)

KDE Software Announcements

The following new KDE software has been announced this week: You can find more new KDE software releases at kde-apps.org.

Comments (none posted)

GUI Packages

Whats coming in GTK+ 2.12

Matthias Clasen has sent out a series of emails describing changes coming to GTK+ 2.12. "I thought it might be a good idea to anticipate the release announcement for GTK+ 2.12 by writing a series of mails about some of the new features that will appear in the next stable release. I hope that this inspires some people to play with the new stuff, so that we can - find api holes and problems before they get frozen in the stable release - get some feedback on the quality (or lack thereof) of the api docs - inspire people to write examples or gtk-demo additions that show new stuff".

Full Story (comments: none)

Multimedia

Sofa 0.2.2 released

Version 0.2.2 of the Sofa Media Center, an audio and video media player for GNOME, has been announced: "Another bug fix release, this one should correct all compilations error users have been having. It contains some clean ups in the code but with no new features. Still, it should be more stable."

Comments (none posted)

Music Applications

Csound 5.06 released

Version 5.06 of Csound, a computer music system, is out. "As part of our continuing plans Csound 5.06 was release on Wednesday 6 June 2007. Apart from the usual bug fixes and bug introductions there are a number of new opcodes, and a significant progress in merging CsoundAV functionality into the Sourceforge tree."

Full Story (comments: none)

Office Suites

KOffice 1.6.3 released (KDE.News)

KDE.News has announced the release of the KOffice 1.6.3 office suite. "The KOffice team today released the third minor release of the 1.6 series. As the development focus has shifted to the next major release, this new version was aimed at polishing and fixing bugs. With this new version, three new languages are added to the list of translations: Bulgarian, Low Saxon and Nepali."

Comments (none posted)

OpenOffice.org release 2.2.1

Release 2.2.1 of the OpenOffice.org office suite is out. "This is a minor bug fix release - full details of the changes may be found in the Release Notes".

Full Story (comments: none)

Science

Kalkulon 3.0.0 released

Stable version 3.0.0 of Kalkulon has been announced. "Kalkulon is a plattform-independent scientific expression calculator. It has a C-like expression syntax and its own small programming language. The GUI version is written for Qt 4.2 (or later) and supports nice syntax coloring even for single digits in larger numbers. The console version supports the readline library."

Comments (none posted)

Video Applications

Gnash 0.8.0 released

Gnash 0.8.0 is out; this one has been designated the third alpha Gnash release. Improvements include support for YouTube videos, a number of virtual machine upgrades, a simple Flash debugger, and more. "Gnash supports the majority of Flash opcodes up to SWF version 7, and a wide sampling of ActionScript classes for SWF version 8.5. All the core ones are implemented, and many of the newer ones work, but may be missing some of their methods."

Full Story (comments: 1)

Miscellaneous

Soothsayer revision 56 released

Revision 56 of Soothsayer has been announced. "Soothsayer is an intelligent predictive text entry platform. Soothsayer exploits redundant information embedded in natural languages to generate predictions. Soothsayer's modular and pluggable architecture allows its language model to be extended and customized to utilize statistical, syntactic, and semantic information sources. "

Comments (none posted)

Languages and Tools

Caml

Caml Weekly News

The June 12, 2007 edition of the Caml Weekly News is out with new Caml language articles.

Full Story (comments: none)

Perl

Better Code Through Destruction (O'Reilly)

Igor Gariev discusses Perl garbage collection on O'Reilly. "Larry Wall said that Perl makes easy things easy and hard things possible. Perl is good both for writing a two-line script that saves the world at the last minute (well, at least it saves you and your project) and for robust projects. However, good Perl programming techniques can be quite different between small and complex applications. Consider, for example, Perl's garbage collector. It frees a programmer from memory management issues most of the time...until the programmer creates circular references."

Comments (none posted)

Python

Python-URL! - weekly Python news and links

The June 11, 2007 edition of the Python-URL! is online with a new collection of Python article links.

Full Story (comments: none)

Shells

Hotwire 0.556 released

Stable version 0.556 of Hotwire is available. "Hotwire is intended to replace the interactive command execution portion of a typical Unix shell. It includes much of the functionality found in the combination of a terminal emulator, a shell, and core utilities like ls and grep. Most of the commands are named the same, and do basically the same thing. Where it makes sense, Hotwire improves the commands to have better defaults and makes things nicer by using the mouse, and so on."

Comments (none posted)

Tcl/Tk

Tcl-URL! - weekly Tcl news and links

The June 12, 2007 edition of the Tcl-URL! is online with new Tcl/Tk articles and resources.

Full Story (comments: none)

XML

XQuery, the Server Language (O'Reilly)

Kurt Cagle looks at XQuery on O'Reilly. "In February 2007, the XQuery specification became a formal W3C Recommendation, after nearly six years of development. As a language, XQuery can best be thought of as a way to turn the integrated language used to retrieve sets of nodes from an XML document, XPath, into a standalone language. To do so, XQuery adds a number of features--command and control structures (such as for expressions), the ability to create intermediate date variables (the let keyword), conditional handling (if/then/else), and the like to the XPath 2.0 language. Perhaps more significantly, however, XQuery also adds the ability to create modules consisting of collections of XQuery functions, and provides a way to subscribe to external functions within their own respective namespaces."

Comments (none posted)

Libraries

Cairo release 1.4.8 now available

Version 1.4.8 of the Cairo 2D graphics library is out. "This release includes a thread-safe surface-cache for solid patterns which significantly improves text rendering with the xlib backend. Also, dozens of error paths in cairo have been fixed thanks to extensive fault-injection testing by Chris Wilson."

Full Story (comments: none)

CLAM 1.1 released

Version 1.1 of CLAM, a C++ library for audio and music, is out. "After a very intense development months since the last 1.0 release, the CLAM crew is glad to announce that CLAM 1.1 is ready to download. It comes with many new features and code clean up. Most important improvements are found in the Visual Prototyping front: new 3D-looking widgets, new data viewers and control surface; and a simplified way to bind controls between the user interface and the processing network."

Full Story (comments: none)

Miscellaneous

GNU tar 1.17 released

Version 1.17 of GNU tar is out with several bug fixes and a new feature. See the release announcement for details.

Comments (none posted)

Page editor: Forrest Cook
Next page: Linux in the news>>


Copyright © 2007, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds