cookin/relaxin

Friday, April 11, 2008

A Processing library for EchoNest

I've just built my first Processing library. It's probably of no use to anybody but y'never know. It's just a parser for the EchoNest Analysis API - a music analysis tool that generates detailed descriptions of a song's structure and musical content. I've been playing with it recently to create visualisations in Processing.

Download the library

Just create a directory called "echonest" in your Processing/libraries folder. Inside that put the contents of the unzipped archive. The important bit is that you end up with another directory called "library" containing the "echonest.jar" file. Restart Processing and add "import echonest.*;" to the top of your sketch.

The library just parses the EchoNest XML format and provides easy access to that data. To do the actual analysis you need to go here and follow the instructions. The library is used like this...


echonest = new EchoNest(this); // Create an instance
echonest.parseXML(analysisFile); // Parse the EchoNest XML (it should be in the data directory)
println(echonest.tempo); // Print out the tempo
// Print out the start times for all the sections...
for (int ct=0; ct<echonest.sections.length; ct++) {
println(echonest.sections[ct].start);
}


...where "analysisFile" is the location of the XML file you got from the EchoNest API as described here and should be in the /data directory of your sketch.

You can then access all the attributes of the song with the following fields:

public String decoderName, decoderVersion;
public float trackDuration, trackUsableDuration;
public int trackVersion;
public float endOfFadeIn, startOfFadeOut;
public int sizeTimbre, sizePitches;
public int numBeats, numTatums, numSegments, numSections;
public float segmentDurationMean, segmentDurationVariance;
public float timeLoudnessMaxMean, loudMaxMean, loudnessMaxVariance;
public loudnessBeginMean, loudnessBeginVariance;
public loudnessDynamicsMean, loudnessDynamicsVariance, loudness;
public float tempo, tempoConfidence, beatVariance;
public float tatum, tatumConfidence, numTatumsPerBeat;
public int timeSignature;
public float timeSignatureStability;
public float[] timbreMean;
public float[] timbreVariance;
public float[] pitchMean;
public float[] pitchVariance;
public float[] tatums;
public Section[] sections = new Section[0];
public Segment[] segments = new Segment[0];


The Section class has the following fields:

public float start;
public float duration;


The Segment class has the following fields:

public float start;
public float duration;
public float loudnessBegin, loudnessMax, loudnessEnd, timeLoudnessMax;
public float[] pitches;
public float[] timbreCoeff;


These fields are all as described in the EchoNest documentation and the source code is included in the download if you get stuck.

That's about it. Let me know if you find it useful.

Sunday, February 10, 2008

Birdlife



Birds seen this week in our garden (for posterity):

2 Blackbirds (male & female)
2 Long-tailed Tits
1 Great Tit
2 Wrens
2 Greenfinches (male & female)
1 Siskin
Robins
Bluetits
Sparrows & Dunnocks

Much better than my Big Garden Watch survey the other week when I saw a grand total of 2 sparrows.

Tuesday, January 08, 2008

Antipodean reading

I'm going to Australia and New Zealand for a month or so in March and right now we're in the middle of quite a large and complex operation of sorting out where to go, booking flights and finding accommodation. Anyway, to the point. I always like to try to read a couple of books that originate from, or are about, the country I'm visiting. So has anyone got any suggestions for Antipodean reading? It could be fiction or non-fiction and food-related or history books are always good.

Also if anyone has any suggestions for places to stay in the Hunter Valley or Blue Mountains then that would be most helpful.

Update: And, of course, I should have thought of the wonderful Daunt Books on Marylebone who include guides, novels and non-fiction arranged by country. They had the not-available-at-Amazon "The Future Eaters", as recommended by Angus

Thursday, January 03, 2008

Reading in 2007

A list, in no particular order, of what I read in 2007. Mainly for my own future reference I think.

Empire, Niall Ferguson
History of the British empire, was it beneficial or not?

Virtual History, Niall Ferguson
Not-so-good collection of things that didn't actually happen. Only edited by Mr Ferguson.

War of the World, Niall Ferguson
Conflict in the 20th century. Excellent.

The Perfect Heresy, Stephen O'Shea
On the crusade against the Cathars in southern France. Not as good as...

Sea of Faith, Stephen O'Shea
The history of Christianity and Islam around the Mediterranean. Best read in the Mediterranean sun.

Six Memos for the Next Millennium, Italo Calvino
Short essays on literary themes.

The Black Swan, Nassim Nicholas Taleb
How to deal with highly improbable events and why stockmarkets are pretty random really.

The Undercover Economist, Tim Harford
Easy guide to economics. Including why Starbucks make you feel special whilst you spend more money and anti-sales. Very appropriate at this time of year.

Mediated, Thomas de Zengotita
On media and contemporary culture. I remember thinking "wow" a lot.

Everyware, Adam Greenfield
On embedded computing. Didn't finish it, sorry

In The Bubble, John Thackara
On sustainable design and how to rely on less stuff.

Net, Blogs and Rock 'n' Roll, David Jennings
Good overview of music discovery on the web, though you might know it already.

Programming Collective Intelligence
The title's a bit more exciting than the contents but loads of useful stuff on collaborative filtering, recommendations and data mining. For future reference.

Achtung Schweinhund!, Harry Pearson
Reminiscing on wargames.

Kitchen Confidential, Anthony Bourdain
What it's really like to be a chef.

Atonement, Ian McEwan
Good. Wasn't going to see the film before I read it. Still haven't seen it though.

Arthur & George, Julian Barnes
Arthur Conan Doyle takes on a case. I was a bit sceptical at first but it's good.

Spies, Michael Frayn
One of my favourite authors.

The Fall of Troy, Peter Ackroyd.
Very atmospheric.

Infinite Jest, David Foster Wallace
I couldn't finish this. I really like his essays but this was just too dense and footnoted.

Hetty Dorval, Ethel Wilson
A present. Hadn't heard of the author but short and sweet.

JPod, Douglas Coupland
OK, not up to Microserfs standard.

Northern Lights/The Subtle Knife/The Amber Spyglass, Philip Pullman
I enjoyed these. The ending was slightly disappointing but the build-up was good.

Virtual Light, William Gibson
Good, another author to start reading through.

Always Coming Home, Ursula K. Le Guin
As recommended by Mr Webb. Very interesting concept of a future anthropology, not easy to read though.

Shadow of the Wind, Carlos Ruiz Zafon
Good to read in Barcelona, as managed by A.

Restless, William Boyd
Nice little spy thriller.

Silence of the Grave, Arnaldur Indriưason
Ah, Icelandic detective fiction. There's a genre.

The Lighthouse, P.D.James
Never actually read any before this, only seen on TV, but enjoyed it.

The Thing on the Doorstep, H.P. Lovecraft
I remember reading about these stories while at school and eventually got round to reading (most of) them.

Watchmen, Alan Moore
One of the best graphic novels ever. And there's a film coming.

Global Frequency: Planet Ablaze, Warren Ellis
Another graphic novel. Bit short for me. I like them wordier.


15 non-fiction and 19 fiction. Not a bad balance.

Friday, December 14, 2007

Grumbling about the iPlayer

Just a little grumble about the BBC iPlayer interface. Now that it's Flash streaming (well done!) I can actually use it.

But can't I just have a list? I know it's supposed to be TV on the web but if I want to watch something I missed last night I just want to scan a list and click on it. I don't want promo images of the programme and I sure don't want to have to click through grids of images.

And URLs?

http://www.bbc.co.uk/iplayer/page/item/b008flpc.shtml?q=spooks&start=1&scope=iplayersearch&go=Find+Programmes&version_pid=b008md6r

That's not good is it? Lucky we've got /programmes, maybe they'll do something with iPlayer content.

UPDATE - Well, looks like they've embedded them already (and on the day after the Christmas party). Go team!

Disclaimer - These are my personal views and not those of the BBC, my employer.