Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Mixscan by Dubset

Mixscan by Dubset

Ratings: (0)|Views: 196 |Likes:
Published by Julian Baldwin

More info:

Categories:Types, Recipes/Menus
Published by: Julian Baldwin on Jul 22, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





MixSCANis a RESTful job-based API that allows you to fingerprint individual files that may contain more than onesong or artist over time. What do we mean by job based? Each time you make a request toMixSCANyou will bereturned with a small amount of metadata for the mix
the scan has actually taken place. This allows you to goback and ping the API about the status of your scan over time. The worker queue for our Limited Preview duringMusic Hack Day NYC isn't gigantic, so proceed with caution.
All examples in this documentation are implemented usingnode.js, which is the underlying runtimeenvironment poweringMixSCAN
The first thing that you will needto do before you can start scanning and working with mixes is to authenticate withMixSCAN. The MixSCAN API usesHTTP Basic Authto identify users. Basic Auth is actually incredibly simple to implement: just include the 'Authorization' header with the 'Basic' realm your 'username:password' base64 encoded:
 varhttp=require('http');  varencodedCredentials= newBuffer('username:password').toString('base64')  varoptions= { host: 'api.mixscan.com', port: 80, path: '/', method: 'POST', headers: {  'Authorization': 'Basic ' +encodedCredentials  } }; http.request(options, function (response) {  // // You just made an authenticated request to MixSCAN. // }); 
So now that we know how to make an authenticated request, lets start fingerprinting mixes. There are two ways todo this with theMixSCANAPI. The first is by sending 'application/json' content with a remote URL pointed to whereyour mix lives on the Web:
 varoptions= { host: 'api.mixscan.com', port: 80, path: '/scans', method: 'POST', body:JSON.stringify({ download: true, media:http://forwardslashtheinternet.com/your-mix.mp3  }),headers: {
converted by Web2PDFConvert.com
 'Authorization': 'Basic ' +encodedCredentials,  'Content-Type': 'application/json'  } }; // // Use http.request() to make the same request with these options // 
The other way that you can start a scan is to POST raw 'audio/mpeg' to the same URL:
 varfs=require('fs');  fs.readFile('your-mix.mp3', function (err,data) {  if (err) returnconsole.log('Hey your files wasnt on disk, what gives?');  varoptions= { host: 'api.mixscan.com', port: 80, path: '/scans', method: 'POST', body:data, headers: {  'Authorization': 'Basic ' +encodedCredentials  'Content-Type': 'audio/mpeg'  } }; // // Use http.request() to make the same request with these options // }); 
Whether you upload an audio file to MixSCAN or provide a URL of a mix to download remotely, you will always getback a aJSON literalwith a small amount of metadata for your mix. Here's a quick sample:
 { "_id": "mixmDtMzs",  "type": "mix",  "createdAt": 1297508724866,  } 
The key property in that object is the '_id', which is the unique identifier for your pending mix scan and whencompleted, the results. Once you've created a job you can simply query the API by making a request to '/scans/:id'.When your mix scan is complete, the JSON object returned will have an array of 'samples' that look something likethis:
 { "startTime": {  "msecs": 526200  }, "length": {  "msecs": 145628  }, "best": {  "id": "915317",  "ber": 0.377441,  "album": "Make Her Say",  "publisher": "UMG",  "artist": "Kid Cudi",  "title": "Make Her Say",  "timeAt": {  "msecs": 189835
converted by Web2PDFConvert.com

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->