Skip to content

Instantly share code, notes, and snippets.

Avatar

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
plamere / genre_playlist.py
Created Jan 16, 2014
example of using creating genre radio
View genre_playlist.py
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 Jan 3, 2016
Get similar genres to any genre
View sim_genres.py
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 Jan 16, 2014
Shows the top artists for a genre
View top_artists_for_genre.py
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 Jan 16, 2014
Output from all_genres.py
View genre_list.txt
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 Jan 16, 2014
Example of listing all Echo Nest genres along with their descriptions
View all_genres.py
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 Oct 25, 2013
Generates playlists that embed a secret message as an acrostic
View acrostic.py
#
# 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
View spotify-echo-nest-playbutton.html
<!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 Feb 21, 2013
Loudness and Confidence filter
View gist:5004349
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) {
View combine.py
"""
combine.py
alternate between two audiofiles, beat by beat
By Paul Lamere, 2013-01-25
"""
import echonest.audio as audio
usage = """