amarok
Audio: Weighted Playlists, exploitation vs. exploration
Submitted by CAPSLOCK2000 on 29 September, 2009 - 15:32This is the fourth part of a series of articles that describe the way I run my computers. These articles are not intended as tutorials and do not contain the details to mirror my setup. They are written in one go, and most certainly contain errors. Feel free to ask for details if you are interested. I will try to update whenever it's appropriate. This article is about how I manage my audio files.
The Problem
Before we get to the technical part of this article I will have to describe my musical preferences.
- I like to explore new music; I constantly download new and unkown music.
- I like variation; listening to the same album three times in a row is nothing for me.
- I like albums; some songs need to be heard in their context to fully appreciate them
- 90% of everything is crap; most albums contain only one are two decent songs.
As a consequence of these four points I have a lot of music that I hardly know, and a lot of music that is rather bad. If I only listened to the music that I know to be good I would never hear anything new. If I played all songs randomly I would be listening to bad music most of the time. In Artificial Intelligence we would call it a problem of exploration versus exploitation.
Gathering Information
So I want a playlist that balances the quality of a song with when it was played last.
To do so this information needs to be recorded. The last play date is easy, my audio player (Amarok) automatically keeps track of that. The quality has to be determined manually. I rate my songs on a 1-10 scale (and 0 for unrated files). Rating takes a lot of time, it took me three years, and I'm still not completely done.
The solution
My solution to the playlist problem is to associate each level with a time period, which indicates how often I want to hear a song.
For example:
| Rating | Delay |
| 10 | 2 months |
| 9 | 3 months |
| 8 | 5 months |
| 7 | 8 months |
| 6 | 12 months |
| 5 | 22 months |
| 2-4 | 26 months |
| 1 | never |
This means that my favorite songs are added to the playlist two months after they have been played for the last time. Most songs are only played once every 22 months. Almost two years between plays seems like an awfully long time, but remember that these are the songs that I do not consider very good (but not bad either), or that I want to hear again before assigning a final rating. I believe that you should hear something at least twice before you can decide on it. There is a lot of music that I couldn't appreciate the first time I heard it, so when in doubt I don't delete.
Low Ratings
Rating 1 songs are never automatically queued. Its stuff that I don't want to hear, but don't want to delete either.
Rating 2-4 is lumped together in one group. Anything below rating 5 I consider bad music. I want to hear those songs once in a while in case my taste or opinion changes, but they shouldn't dominate my playlist. This playlist is limited to 150 songs.
Implemenation
Amarok 1.4 has everything that is needed. I use the Smart Playlist feature to automatically generate playlists that match the above specification.
Besides the categories above I also have a special playlist for new and unrated music that's also added to the mix.
Example
Right now my playlist looks like this:
| Rating | # Songs |
| 10 | 39 |
| 9 | 50 |
| 8 | 68 |
| 7 | 88 |
| 6 | 265 |
| 5 | 489 |
| 2-4 | 150 |
| new | 321 |
Notes
Albums
I mentioned earlier that I like albums. Amarok has a nice "random album" feature, that randomly selects an album from the current playlists, and plays all songs from that album that are on the playlist. When used with the above set of playlists it ensures that songs from the same album are always played in order, but the good songs will be on the list more often than the bad tracks.
Size
I try to keep my playlist between 1000 and 1500 songs. A short playlist loads much faster, but a long playlist increases the probability that more than one song from the same album is on the list.
Audio: 2.1 + headphones for the lazy
Submitted by CAPSLOCK2000 on 17 September, 2009 - 19:08I've decided that I should document as much about my setup as possible. I'll start off easily with my audio setup.
My computer has a pair of normal speakers and a subwoofer. During the night I use a headphone. In the past this involved plugging the headphones into the amplifier to switch.
However the Creative SoundBlaster Audigy allows for a much more nifty setup. I suppose that other 5.1 capable sound cards are probably able to do the same.
Amarok 1.4 not rebuilding collection
Submitted by CAPSLOCK2000 on 11 August, 2009 - 13:20mostly a reminder to myself:
When Amarok 1.4 refuses to rebuild it's collection, even when starting with a new configuration, try "touch /dir/to/mp3".
PS. Yes, I still use Amarok 1.4. Dynamic playlists have become a requirement for me. While the "fuzzy" playlists of Amarok 2 are a nice idea, they do not provide the level of control that is available in Amarok 1.4.
The real show-stopper for me is that there are no relative time intervals in Amarok 2. I want to be able to ask for "All tracks that have not been played in the last 3 months". Amarok2 only supports absolute times (eg "All tracks that have not been played since 01-01-2003").
PS2. What I want is queries like:
(rating == 5 && last_played > 3 months) ||
(rating == 4.5 && last_played > 4 months) ||
(rating == 4.0 && last_played > 5 months)
I'll probably have to write it myself.
Graphing Amarok with Matlab
Submitted by CAPSLOCK2000 on 23 January, 2008 - 21:51The DCOP interface to Amarok provides lots of fun. Especially interesting is the query command, that accepts SQL queries on the collection.
For example:
% dcop amarok collection query "SELECT count(rating) FROM STATISTICS GROUP BY rating" > stats.txt
Once this kind of data is available, the best way to visualise it is obviously to plot it. As I've spent a lot of my time in Matlab recently, that's the tool I'll use for this exercise.
>> load rating.txt;
>> plot([0:0.5:5], rating);
(I've left out the commands title the axes and stuff like that).

By default I set my songs to rating 2.5 . I've too much music to spend a lot of time on rating each song. Therefore I assume that each song is reasonably OK, otherwise it wouldn't be in my collection. I've still have to set about 500 songs to this default rating. From this graph it's obvious that I'm not very good at judging how much I like a song, as I have more songs rated 4 than 3.5, and almost exactly as much songs rated 4.5 as 5.
Now let's see how often the songs in my playlist have been played.
($ = shell code, >> = matlab code)
% dcop amarok collection query "SELECT count(playcounter) FROM STATISTICS GROUP BY playcounter" > playcounter.txt
>> load playcounter.txt;
>> plot([0:length(playcounter)-1], playcounter);

That was easy. This plot reveals that I've heard the majority of my collection only once. Only 22% has been played more than once (about 5200 songs), and only 3% (about 750 songs) more than twice.
Now let's try something slightly more complex. This time I'm interested in the number of songs played per day. Unfortunately that information is not available anywhere, but I found a way to get an approximation. My music collection is fairly large. In fact it is so large that I have heard most songs only once (as has been shown above). Therefore the number of songs I've heard last on a certain day is an approximation for the number of songs I've heard that day. This is of course biassed, but not too much.
$ dcop amarok collection query "SELECT accessdate FROM STATISTICS WHERE accessdate<>0" > accessdate.txt
>> load accesdate.txt; % load the data
>> accessdate2 = accessdate(accessdate~=0); % not interested in songs that have never been played
>> tabulated = tabulate(floor(((accessdate2-min(accessdate2))/(24*3600)))); % convert the unix timestamps to days, and tabulate the date
>> plot(tabulated(2:end, 1), tabulated(2:end, 2)); % plot it all

Clearly visible from this image are two incidents (at day 51 and day 164) where a broken sound backend caused Amarok to skip through the playlist rapidly. Between day 417 and 446 I was abroad, which is clearly visible from the drop in the graph. On average I play 122 songs per day.
Another thing visible from the graph is that I'm never at home at the weekends, causing the steep drops every few days. Until day 183 this was every other weekend, as can be seen by the wider peeks.




