Posts Tagged demo

Getting the Hotttest Artists in any genre with The Echo Nest API

If you spend a few hours listening to broadcast radio it becomes pretty evident who the most popular pop artists are.  You can’t go too long before you hear a song by Justin Timberlake, Rihanna, Bruno Mars or P!nk.  The hotttest pop artists get lots of airplay.  But what about all the other music out there?  Who are the hotttest gothic metal artists? Who are the most popular Texas blues artists?   Those are the kind of questions we try to answer with today’s Echo Nest demo:  The Hotttest Artists

Screenshot_3_29_13_1_04_PM

This app lets you select from among over 400 different genres from a cappella to Zydeco and see who are the hotttest artists in that genre.  The output includes a brief bio and image of the artist, and of course you can listen to any artist via Rdio.   The app is an interesting way to explore all of the different genres out there and sample some different types of music.  The source is available on github. The whole thing including all Javascript, html and CSS is less than 500 lines.

Try out the Hotttest Artist app  and be sure to check out all of the other Echo Nest demos on our demo page.

 

Leave a Comment

Getting Artist Images with the Echo Nest API

This week I’ve been writing a few web apps to demonstrate how to do stuff with The Echo Nest API.   One app shows how you can use The Echo Nest API to get artist images.  The app is nice and simple. Type in the name of an artist and it will show you 100 images of the artist.

Screenshot_3_27_13_7_37_AM

The core code to get the images is here:

function fetchImages(artist) {
    var url = 'http://developer.echonest.com/api/v4/artist/images';

    var args = { 
            format:'json', 
            api_key: 'MY-API-KEY',
            name: artist,
            results: 100, 
    }; 

    info("Fetching images for " + artist);
    $.getJSON(url, args,
            function(data) {
                $("#results").empty();
                if (! ('images' in data.response)) {
                    error("Can't find any images for " + artist);
                } else {
                    $.each(data.response.images, function(index, item) {
                        var div = formatItem(index, item);
                        $("#results").append(div);
                    });
                }
            },
            function() {
                error("Trouble getting blog posts for " + artist);
            }
        );
}

The full source is on github.

With jQuery’s getJSON call, it is quite straightforward to retrieve the list of images from The Echo Nest for formatting and display.

The most interesting bits for me was learning how to make square images regardless of the aspect ratio of the image, without distorting them. This is done with a little CSS magic. Each image div gets a class like so:

        .image-container {
            width: 240px;
            height: 240px;
            background-size: cover;
            background-image:"http://example.com/url/to/image.png";
            background-repeat: no-repeat;
            background-position: 50% 50%;
            float:left;
        }

Try out the Artist Image demo , marvel at the square images and be sure to visit the Echo Nest Demo page to see all of the other demos I’ve been posting this week.

1 Comment

Controlling the artist distribution in playlists

The Echo Nest engineering team just pushed out a new feature giving you more control over the artist makeup in playlists.  There is a new parameter to the playlist/static API called distribution that can be set to wandering  or focused.   When the distribution is set to wandering the artists will appear with approximately equal distribution in the playlist. If the distribution is set to focused artists that are more similar to the seed artists will appear more frequently.  When combined with the variety parameter, you have excellent control over the number and distribution of artists in a playlist.  If you want to create a playlist suitable for music discovery, create a playlist with high variety and a wandering distribution.  If you want to create a playlist that more closely mimics the radio experience choose a low variety and a focused distribution.

I’ve put together a little demo that lets you create playlists with different levels of variety and distribution settings. The demo will create a playlist given a seed artist and show you the artist distribution for the playlist.  Here’s the output of the demo with distribution set to focused:

You can see from the artist histogram that the playlist draws more from artists that are very similar to the seed artist (Weezer).  Compare to these results from a wandering playlist with the same seed and variety:

You can see that there is flatter distribution of artists in the playlist.   You can use variety and distribution to tailor playlists to the listener.  For instance, you can give the Classic Rock Radio experience to a listener by setting variety to relatively low, setting the distribution to focused and seeding with a classic rock artist like Led Zeppelin.  Here’s the artist distribution for the resulting playlist:

That looks like the artist rotation for my local classic rock radio.

Give the demo a try to see how you can use variety and distribution to match playlists to your listener’s taste.  Then read the playlist API docs to see how to use the API to start incorporating these attributes into your apps.

The Demo:  Playlist Distribution Demo (source)

, , , , ,

Leave a Comment

The BPM Explorer

Last month I wrote about using the Echo Nest API to analyze tracks to generate plots that you can use to determine whether or not a machine is responsible for setting the beat of a song.   I received many requests to analyze tracks by particular  artists, far too many for me to do without giving up my day job.   To satisfy this pent up demand for click track analysis I’ve written an application called the BPM Explorer that you let you create your own click plots.  With this application you can analyze any song in your collection, view its click plot and listen to your music, synchronized with the plot.  Here’s what the app looks like:

Check out the application here:  The Echo Nest BPM Explorer.  It’s written in Processing and deployed with Java Webstart, so it (should) just work.

My primary motiviation for writing this application was to check out the new Echo Nest Java Client to make sure that it was easy to use from Processing.   One of my secret plans is to get people in the Processing community interested in using the Echo Nest API.  The Processing community is filled with some  ultra-creative folks that have have strong artistic, programming and data visualization skills.   I’d love to see more song visualizations like this and this that are built using the Echo Nest APIs.  Processing is really cool – I was able to write the BPM explorer in just a few hours (it took me longer to remember how to sign jar files for webstart than it did to write the core plotter).    Processing strips away all of the boring parts of writing graphic programming (create a frame,  lay it out with a gridbag, make it visible,  validate, invalidate, repaint, paint arghh!). For processing, you just write a method ‘draw()’ that will be called 30 times a second.   I hope I get the chance to write more Processing programs.

Update: I’ve released the BPM Explorer code as open source – as part of the echo-nest-demos project hosted at google-code.  You can also browse the read  for the BPM Explorer.

, , , ,

11 Comments

Follow

Get every new post delivered to your Inbox.

Join 236 other followers