Archive for category fun

A music hackday hack that makes me smile …

http://www.youtube.com/watch?v=cqV3Wuk5pLQ

(via @atl)

,

Leave a comment

What is a Music Hackday?

Hernik Berggren put together a nifty slide deck along with some video to show people what a Music Hackday is all about.  Check it out on Henrik’s blog:  Music Hackday Revisited.

Leave a comment

The Music Hackday Comes to Boston

The London Music Hackday

<W00T!> -The Music Hackday is coming to Boston.  Set aside the weekend of November 21 and 22 for the Boston Music Hackday being held at  the Microsoft New England Research and Develpment Center (aka NERD).   The Music Hackday is a place where folks can gather for a weekend of nearly uninterrupted hacking on music.  Expect to see (and hear) all kinds of music hacks: from web-hacks, iPhone apps, analog noisemakers to cool visualizations.  Anything goes as long as it is music related.   The Boston hackday is being organized by Dave Haynes (SoundCloud), Jon Pierce (Betahouse) and myself (The Echo Nest).  We here at the Echo Nest are pretty excited to be involved. It should be really fun.

If you hack music and are going to be within a day’s drive of Boston on the weekend before  Thanksgiving, you really should be planning to attend the hackday.  Registration is free, but space is limited. To guarantee a spot register early and be sure you tell us how you want to hack music (because of the limited number of slots, we give preference to music hackers).

Event:   Boston Music Hackday
When:  November 21, 22
Where: NERD
PRICE: $FREE
Register
: http://musichackdayboston.eventbrite.com/

Looking for hacking inspiration? Check out all of the music hacks that were built during the London Music Hackday:

1 Comment

People who shopped for baseball bats …

A fun Freakomendation from Amazon.de:

amazon-freakomendation-baseballbat

via reddit

11 Comments

Auto-tune for the iPhone

According to Rebecca, it is already the in the top 5 iPhone paid apps, (and it was only released yesterday).  Congrats to Rebecca and the rest of the Smule team for creating yet another really cool iPhone music app.

, , ,

3 Comments

The Stairway Detector

Last night I was watching the pilot for Glee (a snarky TV version of High school musical) with my 3 teenage daughters.  I was surprised to hear the soundtrack filled with songs by the band Journey, songs that  brought me back to my own high school years.   The thing that I like the most about Journey is that many of their songs have this slow and gradual build up over the course of the whole song  as in this song Lovin Touchin Squeezin:

A number of my favorite songs have this slow build up. The canonical example is Zep’s ‘Stairway to Heaven’ – it starts with a slow acoustic guitar and over the course of 8 minutes builds to metal frenzy.    I thought it would be fun to see if I could write a bit of software that could find the songs that have the same arc as ‘Stairway to Heaven’ or ‘Lovin, Touchin Squeezin’  – songs that have this slow build. With this ‘stairway detector’  I could build playlists filled with the songs that fire me up.

The obvious place to start with is to look how the loudness of a song changes overtime. To do this I used the Echo Nest developer API to extract the loudness as a function of time for  Journey’s Lovin, Touchin Squeezin:

louness-journey-no-avgIn this plot the light green curve is the loudness, while the blue line is a windowed average of the loudness.  This plot shows a nice rise in the volume over the course of the song.   Compared to a song like the Beatles ‘Ticket to Ride’ that doesn’t have this upward slope:

loudness-ticket-to-ridFrom these two examples, it is pretty clear that we can build our stairway-detector just by looking at the average slope of the volume. The higher the slope, the bigger the build.  Now, I suspect that there’s lots of ways to find the average slope of a bumpy line – but I like to always try the simplest thing that could possibly work first – and for me the simplest thing was to just divide the average loudness of the second half of the song by the average loudness of the first half of the song.   So for example, with the Journey song the average loudness of the second half of the song is -15.86 db and the average of the first half of the song is -24.37 db.  This gives us a ratio of 1.54, while ‘Ticket to ride’ gets a ratio of 1.06.  Here’s the Journey song with averages shown:

loudness-for-journeyHere are a few more songs that fit the ‘slow build’ profile:

stairway-to-heaven‘Stairway to Heaven’ has a score of 1.6 so it has a bigger build than Journey’s Lovin’.

loudness-for-bridge-over-troubled-waterSimon and Garfunkle’s ‘Bridge over troubled water’ has an even bigger build with a score of 1.7.

Also sprach ZarathustraAlso sprach Zarathustra has a more modest score of  1.56

With this new found metric I analyzed a few thousand of the tracks in my personal collection to find the songs with the biggest crescendos.  The biggest of all was this song by Muse with a whopping score of  3.07:

loudness-for-muse-take-a-bowAnother find is Arcade Fire’s “My Body is a Cage” with a  score of 2.32.

loudness-for-my-body-is-a-cage

The metric isn’t perfect. For instance, I would have expected Postal Services ‘Natural Anthem’ to have a high score because it has such a great build up, but it only gets a score of 1.19. Looking at the plot we can see why:

loudness-for-postal-service-natural-anthemAfter the initial build up, there’s a drop an energy for that last quarter of the song, so even though the song has a sustained crescendo for 3 minutes it doesn’t get a high score due to this drop.

Of course, we can use this ratio to find tracks that go the other way, to find songs that gradually wind down. These seem to occur less frequently than the songs that build up.  One example is Neutral Milk Hotel’s Two Headed Boy:

loudness-for-two-headed-boy

Despite the fact that I’m using a very naive metric to find the loudness slope,  this stairway detector is pretty effective in finding songs that have that slow build.   It’s another tool that I can use for helping to build interesting playlists.  This is one of the really cool things about how the Echo Nest approaches music playlisting.   By having an understanding of what the music actually sounds like,  we can build much more interesting playlists than you get from genius-style playlists that only take into account  artists co-occurrence.

, , ,

1 Comment

Making better plots

For many years, I’ve used awk and gnuplot to generate plots but as I switch over to using Python for my day to day programming, I thought there might be a more Pythonic way to do plots.  Google pointed me to Matplotlib and after kicking the tires, I’ve decided to retire gnuplot from my programming toolkit and replace it with matplotlib.

mat-plot-lib

Matplotlib is a 2D plotting library that produces a wide variety of high quality figures suitable for interactive applications or for inserting into publications.  A quick tour of the gallery shows the wide range of plots that are possible with Matplotlib.    The syntax for creating plots is simple and familiar to anyone who’s used matlab for plotting.

With this new tool in my programming pocket, I thought I’d update my click plotter program to use matplotlib.  (The click plotter is a program that generates plots showing how a drummer’s BPM varies over the course of a song.  By looking at the generated plots it is easy to see if the beat for a song is being generated by a man or  a machine. Read more about it in ‘In Search of the Click Track‘).

The matplotlib code to generate the plots is straightforward:

def plot_click_track(filename):
   track = track_api.Track(filename)
   tempo = float(track.tempo['value'])
   beats = track.beats
   times = [ dict['start'] for dict in beats ]
   bpms = get_bpms(times)
   plt.title('Click Plot for ' + os.path.basename(filename))
   plt.ylabel('Beats Per Minute')
   plt.xlabel('Time')

   plt.plot(times, get_filtered_bpms(bpms), label='Filtered')
   plt.plot(times, bpms, color=('0.8'), label='raw')
   plt.ylim(tempo * .9, tempo * 1.1)
   plt.axhline(tempo, color=('0.7'), label="Tempo")
   plt.show()

The complete source code for click_plot is in the example directory of the pyechonest module.

Here are a few examples plots generated by click_plot:

tom-sawyer-live

porcupine_tree_what_happens_now

buddy_rich_on_carson

elp_rondo_live

To create your own click plots grab the example from the SVN repository, make sure you have pyechonest and matplotlib installed, get an Echo Nest API key and start generating click plots with the command:

%  click_plot.py  /path/to/music.mp3

, , ,

Leave a comment

DJ API’s secret sauce

Last week at the Echo Nest 4 year anniversary party we had two renown DJs keeping the music flowing.  DJ Rupture was the featured act – but opening the night was the Echo Nest’s own DJ API (a.k.a Ben Lacker)  who put together a 30 minute set using the Echo Nest remix.

 

DJ API at work (Photo by Jason Sundram

DJ API at work (Photo by Jason Sundram

I was really quite astounded at the quality of the tracks Ben put together (and all of them apparently done on the afternoon before the gig).  I asked Ben to explain how he created the tracks. Here’s what he said:

1. ‘One Thing’ – featuring Michael Jackson’s (dj api’s rip)

I found a half-dozen a cappella Michael Jackson songs as well as instrumental and a cappella recordings of Amerie’s “One Thing” on YouTube. To get Michael Jackson to sing “One Thing”, I stitched all his a cappella tracks together into a single track, then ran afromb: for each segment in the a cappella version of “One Thing”, I found the segment in the MJ a cappella medley that was closest in pitch, timbre, and loudness. The result sounded pretty convincing, but was heavy on the “uh”s and breath sounds. Using the pitch-shifting methods in modify.py, I shifted an a cappella version of “Ben” to be in the same key as “One Thing”, then ran afromb again. I edited together part of this result and part of the first result, then synced them up with the instrumental version of “One Thing.”

2. One Thing (dj api’s gamelan version)

I used afromb again here, this time resynthesizing the instrumental version of “One Thing” from the segments of a recording of a Balinese Gamelan Orchestra. I synced this with the a cappella version of “One Thing” and added some kick drums for a little extra punch

3. Billie Jean (dj api screwdown)

First I ran summary on an instrumental version of Beyoncé’s “Single Ladies (another YouTube find) to produce a version consisting only of the “ands” (every second eighth note). I then used modify.shiftRate to slow down an a cappella version of “Billie Jean” until its tempo matched that of the summarized “Single Ladies”. I synced the two, and repeated some of the final sections of “Single Ladies” to follow the form of “Billie Jean

It was a great set and everyone had a good time listening to the morphed tunes. At the next party hopefully we’ll get to see Ben do some live remix performance programming during the set (which of course won’t be a set, it will really be a python list).

, , ,

7 Comments

Artist radio in 10 lines of code

Last week we released Pyechonest, a Python library for the Echo Nest API.  Pyechonest gives the Python programmer access to the entire Echo Nest API including artist and track level methods.  Now after 9 years working at Sun Microsystems, I am a diehard Java programmer, but I must say that I really enjoy the nimbleness and expressiveness of Python.  It’s fun to write little Python programs that do the exact same thing as big Java programs.  For example, I wrote an artist radio program in Python that, given a seed artist, generates a playlist of tracks by wandering around the artists in the neighborhood of the seed artists and gathering audio tracks.   With Pyechonest, the core logic is 10 lines of code:

def wander(band, max=10):
   played = []
   while max:
     if band.audio():
         audio = random.choice(band.audio())
         if audio['url'] not in played:
             play(audio)
             played.append(audio['url'])
             max -= 1
     band = random.choice(band.similar())

(You can see/grab the full code with all the boiler plate in the SVN repository)

This method takes a seed artist (band) and selects a random track from set of audio that The Echo Nest has found on the web for that artist, and if we haven’t already played it, then do so. Then we select a near neighbor to the seed artist and do it all again until we’ve  played the desired number of songs.

For such a simple bit of code, the playlists generated are surprisingly good..Here are a few examples:

Seed Artist:  Led Zeppelin:

(I think the Dale Hawkins version of Susie-Q after  CCR’s Fortunate Son  is just brilliant)

Seed Artist: The Decemberists:

(Note that audio for these examples is audio found on the web – and just like anything on the web the audio could go away at any time)

I think these artist-radio style playlists rival just about anything you can find on current Internet radio sites – which ain’t to0 bad for 10 lines of code.

, , , , , ,

9 Comments

Echo Nest Remix 1.2 has just been released

Just in time for hack day … Quoting Brian:

Hi all, 1.2 just “released.” There are prebuilt binary installers for Mac and Windows, and pretty detailed instructions for Linux and other source installs.

The main features of Remix 1.2 are video processing and time/pitch stretching, along with a reliance of “pyechonest” to do the communication with EN. This lets you do more than just track API calls.

Some relevant examples included in the stretch and videx folders.

Thanks to all for the hard work.

This release ties together the video processing, time and pitch stretching, making it possible to do the video and the stretching remixes from the same install. Awesome!

,

Leave a comment