Skip to content

Instantly share code, notes, and snippets.

@plamere
plamere / catalog_sample.py
Created May 25, 2011 18:51
Example of creating an Echo Nest Personal Catalog from a directory of MP3s
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright (c) 2010 The Echo Nest. All rights reserved.
Created by Tyler Williams on 2011-04-08
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
@plamere
plamere / dedup.py
Created June 25, 2011 13:05
dedup.py - uses echoprint to find duplicates in a music collection
#!/usr/bin/python
import sys
import os
import pprint
import subprocess
import pickle
import atexit
import simplejson as json
sys.path.insert(0, "../API")
@plamere
plamere / index.html
Created December 6, 2011 13:45
Demonstration of how to call the Echo Nest API from a Spotify App
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Playlister</title>
<link rel="stylesheet" href="sp://import/css/adam.css">
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
</head>
@plamere
plamere / TopTwitter.html
Created January 11, 2012 13:08
Top hotttest Twitter artists
<!DOCTYPE html>
<html>
<head>
<title>Top Twitter</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<link type="text/css" href="styles.css" rel="stylesheet" />
</head>
<body>
<h1 id='title'> Top 100 artists with verified Twitter accounts</h1>
<ol id="results"> </ol>
@plamere
plamere / PlaylistWithDistribution.html
Created January 12, 2012 13:45
Demo of of Echo Nest playlist generation with variety and distribution
!DOCTYPE html>
<html>
<head>
<title>Playlist Distribution Demo</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<link type="text/css" href="demo_styles.css" rel="stylesheet" />
</head>
<body>
@plamere
plamere / lyrical_playlist.py
Created February 17, 2012 20:46
Example of using LyricFind and Echo Nest to generate a playlist with lyrics
import sys
import urllib
import json
from pyechonest import playlist
def show_playlist(seed_artist):
for s in playlist.basic(artist=seed_artist, type='artist-radio', ]
buckets=['id:lyricfind-US'], results=10, limit=True):
print '=================================================================='
@plamere
plamere / FetchTrackAndAnalysisData.js
Created April 9, 2012 09:39
Syncing Echo Nest analysis to Spotify playback
function fetchSongInfo(track) {
info('Getting song info for ' + track.name + ' by ' + track.artists[0].name);
var url = 'http://developer.echonest.com/api/v4/track/profile?api_key=N6E4NIOVYMTHNDM8J&callback=?';
var track_id = fromSpotify(track.uri);
$.getJSON(url, { id: track_id, format:'jsonp', bucket : 'audio_summary'}, function(data) {
if (checkResponse(data)) {
info("");
showTrackInfo(data.response.track);
fetchAnalysis(data.response.track);
@plamere
plamere / analysis.json
Created April 9, 2012 09:56
Example of detailed Echo Nest analysis
{
"bars": [
{
"confidence": 0.451,
"duration": 1.64692,
"start": 0.7151
},
{
"confidence": 0.32,
"duration": 1.64778,
@plamere
plamere / tweetSetup.html
Created November 27, 2012 11:23
dynamically adapting the tweet button
<body>
The tweet button:
<span id='tweet-span'>
<a href="https://twitter.com/share" id='tweet'
class="twitter-share-button"
data-lang="en"
data-count='none'>Tweet</a>
<script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</span>
"""
combine.py
alternate between two audiofiles, beat by beat
By Paul Lamere, 2013-01-25
"""
import echonest.audio as audio
usage = """