Skip to content

Instantly share code, notes, and snippets.


Paul Lamere plamere

View GitHub Profile
View gist:8976417
Perhaps an analogy would help ... like comparing an API to a car dashboard.
The dashboard is the interface between the car and the human - it has all
the controls you need to make the car do its job. An API is like the
dashboard for a software system. It provides the interface for another
system (typically another computer) to get a system to do its job.
plamere / TrackUploadSample.m
Created April 14, 2014 11:02
Example of uploading a track to the Echo Nest for analysis without ENIOS
View TrackUploadSample.m
- (void) uploadTrack: (Track *) track {
NSDictionary *params = @{
@"filetype" : @"m4a",
@"api_key" : self.apiKey,
NSFileManager *fm = [NSFileManager defaultManager];
NSURL *audioPath = [self pathToAudio:track];
NSString *path = [audioPath path];
NSData *data = [fm contentsAtPath:path];
plamere / spotify_echonest_example
Last active August 29, 2015 14:02
Get Spotify images for the artists that are similar to weezer
View spotify_echonest_example
import pyen
import spotipy
import sys
get a set of images for artists that are similar to
the given seed artist
en = pyen.Pyen()
plamere /
Last active August 29, 2015 14:04
parses outside lands lineup and generates a json of artists along with Spotify, Echo Nest and Rdio IDs
import sys
from bs4 import BeautifulSoup
import json
import pyen
en = pyen.Pyen()
def get_fid(artist, idspace):
if 'foreign_ids' in artist and len(artist['foreign_ids']) > 0:
for fids in artist['foreign_ids']:
if fids['catalog'] == idspace:
plamere / gist:e41f5a163566dddbeba4
Created August 3, 2014 16:27
iterating through artists with spotipy to get the top tracks
View gist:e41f5a163566dddbeba4
for start in xrange(0, 10000, page_size):
response = en.get('catalog/read', id=tpid, start=start,
results=page_size, bucket=['id:spotify'])
if len(response['catalog']['items']) == 0:
spaids = []
for item in response['catalog']['items']:
if 'artist_name' in item:
spid = item['request']['item_id']
plamere /
Created June 20, 2015 09:50
An example of using PBL to create a cynical radio station where every 4th song is by Sia or Katy Perry
from pbl import *
gold = Concatenate([ArtistTopTracks('Sia'), ArtistTopTracks('Katy Perry')])
norm = PlaylistSource("Today's Top Hits")
radio = Alternate([norm, norm, norm, Shuffler(gold)])
radio = PlaylistSave(radio, 'cynical radio', 'plamere', max_size=40)
plamere /
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 / TopTwitter.html
Created January 11, 2012 13:08
Top hotttest Twitter artists
View TopTwitter.html
<!DOCTYPE html>
<title>Top Twitter</title>
<script type="text/javascript" src=""></script>
<link type="text/css" href="styles.css" rel="stylesheet" />
<h1 id='title'> Top 100 artists with verified Twitter accounts</h1>
<ol id="results"> </ol>
plamere / PlaylistWithDistribution.html
Created January 12, 2012 13:45
Demo of of Echo Nest playlist generation with variety and distribution
View PlaylistWithDistribution.html
!DOCTYPE html>
<title>Playlist Distribution Demo</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<link type="text/css" href="demo_styles.css" rel="stylesheet" />
plamere / analysis.json
Created April 9, 2012 09:56
Example of detailed Echo Nest analysis
View analysis.json
"bars": [
"confidence": 0.451,
"duration": 1.64692,
"start": 0.7151
"confidence": 0.32,
"duration": 1.64778,