* @author plamere
*/
public class TrackAnalysisExample {
public static void main(String[] args) throws EchoNestException {
EchoNestAPI en = new EchoNestAPI();
String path = "music/dizzy.mp3";
if (args.length > 2) {
path = args[1];
}
File file = new File(path);
if (!file.exists()) {
System.err.println("Can't find " + path);
} else {
try {
Track track = en.uploadTrack(file);
track.waitForAnalysis(30000);
if (track.getStatus() == Track.AnalysisStatus.COMPLETE) {
System.out.println("Tempo: " + track.getTempo());
System.out.println("Danceability: " + track.getDanceability());
System.out.println("Speechiness: " + track.getSpeechiness());