While attending the first Philly Music Hackday, I learned about the awesome Echo Nest API. I thought it would be interesting to make a mashup with SendGrid and their Remix Library, letting anyone attach two MP3s and become an email DJ. Here’s how Echo Nest describes Remix:

Echo Nest Remix is the Internet Synthesizer. Make amazing things from music, automatically. Echo Nest Remix lets you remix, re-edit, and re-imagine any piece of music and video, automatically and algorithmically

This library gives you the ability to make some pretty crazy modifications to your music.

In this hack, I used the SendGrid Parse Webhook to get the two .mp3 files I want to remix. I pass these two songs to the AfromB.py program in the Remix Library. This program re-synthesizes the first song with segments of the second. I decided to also implement a message queue, with the aid of our friends at iron.io, since the processing time takes around four minutes to remix a song.

Let’s Try It Out

I downloaded two random free mp3 songs from freedownloads.last.fm.

  1. Download the two tracks:
    Duke Robillard – Working Hard for my Uncle
    Art Fact – Rain in the South
  2. Send an email to remix@emaildj.com and make sure to attach two .mp3 files. The MX records of emaildj.com point to SendGrid and the email gets parsed into its components and posted to my application.
  3. In a couple of minutes you will get an email with a .mp3 file as your remix:

    This is the one I received.

App Details

I split this hack up into two php applications. The first one gets the songs posted by the SendGrid Parse API and puts the songs into the Iron.io message queue. If there is currently nothing else in the queue it calls the second program.


The second program goes through each message in the queue and remixes the songs using the EchoNest Remix Library, then emails that mashup back to the user.


You can also check out all the source code of emaildj on Github.

Meet Kunal, Developer Evangelist at-large for SendGrid and home-grown New Jersey hacker. He previously ran General Machines, which developed Deaftel - a phone service for the deaf that converts voice to text and text back into voice over a phone call. Since March 2013, Kunal has been working as a Developer Evangelist at SendGrid, helping enable developers to get the tools and resources they need to make awesome, creative stuff.