// Simple freesound API search demo - November 2013 - rtwomey@u.washington.edu // // 2/13: updated for Processing 2.0, to use XML instead of XMLElement // // // fresound API documentation. We are using the REST api // http://tabasco.upf.edu/docs/api/overview.html#restful // // apply for an API key: // http://www.freesound.org/api/apply/ // void setup() { size(800, 800); String baseURL = "http://www.freesound.org/api/sounds/search?"; // address for flickr web services String apiKey = "47eb8c68c7cd4a36a7aed15b7beddff7"; // my freesound key String tagString="seashell"; // search string String query = baseURL+"q="+tagString+"&api_key="+apiKey+"&format=xml"; // ask for xml output // do actual query call XML xml = loadXML(query); // holds the results //println(xml); // gather results XML[] soundFiles = xml.getChildren("sounds/resource"); // get sound resources //println(soundFiles); println(soundFiles.length + " sounds"); //loop over results for (int i = 0; i < soundFiles.length; i++) { String orig_name = soundFiles[i].getChild("original_filename").getContent(); String url = soundFiles[i].getChild("preview-hq-mp3").getContent(); println(orig_name+" : "+url); // play me! // or store me in an array } } void draw() { // and play me down here }