Skip to content

Instantly share code, notes, and snippets.

View plamere's full-sized avatar

Paul Lamere plamere

View GitHub Profile
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
plamere / genre_playlist.py
Created January 16, 2014 12:44
example of using creating genre radio
import pyen
import sys
en = pyen.Pyen()
if len(sys.argv) < 2:
print 'Usage: python genre_playlist.py seed genre name'
else:
genre = ' '.join(sys.argv[1:])
response = en.get('playlist/static', type='genre-radio', genre_preset='core-best', genre=genre)
@plamere
plamere / sim_genres.py
Last active January 3, 2016 11:09
Get similar genres to any genre
import pyen
import sys
en = pyen.Pyen()
if len(sys.argv) > 1:
genre = ' '.join(sys.argv[1:])
response = en.get('genre/similar', name=genre)
for genre in response['genres']:
print genre['name']
@plamere
plamere / top_artists_for_genre.py
Created January 16, 2014 12:32
Shows the top artists for a genre
import pyen
import sys
en = pyen.Pyen()
if len(sys.argv) > 1:
genre = ' '.join(sys.argv[1:])
response = en.get('genre/artists', name=genre)
for artist in response['artists']:
print artist['name']
@plamere
plamere / genre_list.txt
Created January 16, 2014 12:25
Output from all_genres.py
a cappella - A cappella is singing without instrumental accompaniment. From the Italian for "in the manner of the chapel," a cappella may be performed solo or by a group.
abstract hip hop -
acid house - From house music came acid house, developed in the mid-'80s by Chicago DJs experimenting with the Roland TB-303 synthesizer. That instrument produced the subgenre's signature squelching bass, used to create a hypnotic sound.
acid jazz - Acid jazz, also called club jazz, is a style of jazz that takes cues from a number of genres, including funk, hip-hop, house, and soul.
...
@plamere
plamere / all_genres.py
Created January 16, 2014 12:23
Example of listing all Echo Nest genres along with their descriptions
import pyen
en = pyen.Pyen()
response = en.get('genre/list', bucket=['description'])
for g in response['genres']:
print g['name'], '-', g['description']
@plamere
plamere / acrostic.py
Created October 25, 2013 23:24
Generates playlists that embed a secret message as an acrostic
#
# Generates an acrostic playlist
#
# This was built at the Tufts Hackathon Fall 2013
#
# Creates a playlist in the given genre, where the
# first letter in each song spells out a secret
# message
<!DOCTYPE html>
<html>
<head>
<title>Echo Nest + Spotify Play Button 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 / gist:5004349
Created February 21, 2013 12:14
Loudness and Confidence filter
function runLength(quanta, confidenceThreshold, loudnessThreshold, lookAhead, lookaheadMatch) {
var lastState = false;
for (var i = 0; i < quanta.length; i++) {
quanta[i].needsDrums = false;
}
for (var i = 0; i < quanta.length -1; i+=2) {
"""
combine.py
alternate between two audiofiles, beat by beat
By Paul Lamere, 2013-01-25
"""
import echonest.audio as audio
usage = """