Cal Amp

Created in late 2002, Cal Amp is a WinAmp 2 plugin which feeds tracks you're currently listening to, into a database, over the web.

By collecting this data over time, interesting patterns can emerge. This software was written around the same time as Audio Scrobbler, the statistical engine which now powers last.fm. It was created independantly. It seems like the world was ready for something like this :)

A screen-shot of the web site in action can be seen here.

I've been using Last.fm since April 2004, when I switched to iTunes. My profile is here.


The entire source for Cal Amp can be found on GitHub, here:

The latest tagged version of the plugin source itself is here:

And the latest tagged version of the web logging and display code is here:


There are two things you need to set before you compile. Firstly, change the link target (unless, like me, you have winamp installed on drive G: in the usual folder). In Visual Studio 5, you do this by going to the "FileView" pane, right clicking on the project and selecting "Settings...". Then on the "Link" page, alter the value in the first editbox.

The second thing you need to do is modify the url to your server. The default is set to "http://www.your-url.com/script.php" (line 46 of cal_amp.c) but you'll want to change it to whatever script you use to recieve the data.

How It Works

When a track starts playing, Cal Amp calls http://www.your-url.com/script.php?track-name-here

When a track stops playing, pauses, or winamp is closed, Cal Amp calls http://www.your-url.com/script.php

By responding to these two signals, you can easily enter track data into a database. The second signal can be ignored if you don't care about what's "currently playing", but by using it you can roughly determine if a track is still playing.

A note of warning: If you disconnect from the Internet during use, winamp crashes, or your server goes down, the stop signal will not get sent. It's quite sensible to store the time when a track started, so that you can then check to see if it's been playing longer that a certain "timeout" period, after which you can assume it has been stopped.

In my implementation, i don't log tracks that are played for less than 60 seconds, that way when i shuffle through tracks, they don't get logged.

The rest, is up to you. Suggestions, bug reports and patches can go to cal@iamcal.com

Known Issues

The final stop call when shutting down doesn't usually work. This can probably be fixed by making it synchronous.