Updated Java client for the Echo Nest API

We’ve pushed out a new version of the open source Java client for the Echo Nest API.    The new version provides support for the different versions of the Echo Nest analyzer.  You can use the traditional,  but somewhat temperamental version 1 of the analyzer, or the spiffy new, ultra-stable version 3 of the analyzer.  By default, the Java client uses the new analyzer version, but if you need your application to work the exactly the same way that it did six months ago you can always use the older version.

Here’s a bit of Java code that will print out the tempo of all the songs in a directory:

void showBPMS(File dir) throws EchoNestException {
     TrackAPI trackAPI = new TrackAPI();
     File[] files = dir.listFiles();
     for (File f : files) {
         if (f.getAbsolutePath().toLowerCase().endsWith(".mp3")) {
             String id = trackAPI.uploadTrack(f, true);
             System.out.printf("Tempo 6%.3f %s\n",
                 trackAPI.getTempo(id).getValue(), f.getAbsoluteFile());
         }
     }
}

Running this code on a folder containing the new Breaking Benjamin album yields this output:

Tempo  85.57 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/01 - Fade Away.mp3
Tempo 108.01 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/02 - I Will Not Bow.mp3
Tempo 168.81 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/03 - Crawl.mp3
Tempo 156.75 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/04 - Give Me A Sign.mp3
Tempo  85.51 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/05 - Hopeless.mp3
Tempo  68.34 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/06 - What Lies Beneath.mp3
Tempo 116.94 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/07 - Anthem Of The Angels.mp3
Tempo  85.50 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/08 - Lights Out.mp3
Tempo 125.77 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/09 - Dear Agony.mp3
Tempo  94.99 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/10 - Into The Nothing.mp3
Tempo 160.38 /Users/plamere/Music/Amazon MP3/Breaking Benjamin/Dear Agony/11 - Without You.mp3

You can download the new Java client from the echo-nest-java-api code repository.  The new version is: echo-nest-java-api-1.2.zip

, , , , ,

%d bloggers like this: