Posts Tagged twitter
Learn about a new genre every day
Posted by Paul in code, genre, playlist, The Echo Nest on January 16, 2014
The Echo Nest knows about 800 genres of music (and that number is growing all the time). Among those 800 genres are ones that you already know about, like ‘jazz’,’rock’ and ‘classical’. But there are also hundreds of genres that you’ve probably never heard of. Genres like Filthstep, Dangdut or Skweee. Perhaps the best way to explore the genre space is via Every Noise at Once (built by Echo Nest genre-master Glenn McDonald). Every Noise At Once shows you the whole genre space, allowing you to explore the rich and varied universe of music. However, Every Noise at Once can be like drinking Champagne from a firehose – there’s just too much to take in all at once (it is, after all, every noise – at once). If you’d like to take a slower and more measured approach to learning about new music genres, you may be interested in Genre-A-Day.
Genre-A-Day is a web app that presents a new genre every day. Genre-A-Day tells you about the genre, shows you some representative artists for the genre, lets you explore similar genres, and lets you listen to music in the genre.
If you spend a few minutes every day reading about and listening to a new genre, after a few months you’ll be a much more well-rounded music listener, and after a few years your knowledge of genres will rival most musicologists’.
An easy way to make Genre-A-Day part of your daily routine is to follow @GenreADay on twitter. GenreADay will post a single tweet, once a day like so:
Under the hood – Genre-A-Day was built using the just released genre methods of The Echo Nest API. These methods allow you to get detailed info on the set of genres, the top artists for the genres, similar genres and so on. It also uses the super nifty genre presets in the playlist API that allow you to craft the genre-radio listener for someone who is new to the genre (core), for someone who is a long time listener of the genre (in rotation), or for someone looking for the newest music in that genre (emerging). The source code for Genre-A-Day is on github.
Dynamically adjusting the tweet button
The Infinite Jukebox has a tweet button that allows you to tweet the URL of a song so you can share it with others. The recently added tuning feature encodes all of the tuning information into the URL, making it easy to share a ‘tuned’ infinite song. One challenge I encountered it making this work was dynamically changing the URL that the tweet button will ‘tweet’.
The ‘tweet’ button is a twitter supplied widget. When your page load, a script runs that finds the tweet button on the page and does a bunch of twitter magic to the button (for one thing, it turns the button into an iFrame). When you click the button, the twitter dialog has the URL ready to go. However, if the URL has been programmatically changed (as in my tuning feature), the tweet button won’t pick this up. To make this work, whenever you change the URL of the page, you need to remove the tweet button, re-attach it and then call twttr.widgets.load() to force the twitter button to update.
Here’s the gist:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
The tweet button: | |
<span id='tweet-span'> | |
<a href="https://twitter.com/share" id='tweet' | |
class="twitter-share-button" | |
data-lang="en" | |
data-count='none'>Tweet</a> | |
<script>!function(d,s,id){varjs,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | |
</span> | |
<script> | |
function tweetSetup() { | |
$(".twitter-share-button").remove(); | |
var tweet = $('<a>') | |
.attr('href', "https://twitter.com/share") | |
.attr('id', "tweet") | |
.attr('class', "twitter-share-button") | |
.attr('data-lang', "en") | |
.attr('data-count', "none") | |
.text('Tweet'); | |
$("#tweet-span").prepend(tweet); | |
tweet.attr('data-text', "#InfiniteJukebox of " + t.fixedTitle); | |
tweet.attr('data-url', document.URL); | |
twttr.widgets.load(); | |
} | |
</script> | |
</body> |
Using The Echo Nest to get the top 100 Twitter artists
This week Twitter and The Echo Nest announced a partnership where Twitter IDs for verified accounts are incorporated into The Echo Nest’s ID mapping layer (aka Rosetta Stone). This makes it easy for developers to get the Twitter handle for an artist. To demonstrate just how easy it is, I wrote a little web app that displays the top 100 artists that have verified Twitter accounts. Here’s the core bit of code for the app:
function fetchTopTwitterArtists() { var url = 'http://developer.echonest.com/api/v4/artist/top_hottt?callback=?'; $.getJSON(url, { 'api_key': 'GETYOUROWNAPIKEY', 'format':'jsonp', 'results': 100, 'bucket': ['hotttnesss', 'id:twitter'], 'limit': true}, function(data) { for (var i = 0; i < data.response.artists.length; i++) { var artist = data.response.artists[i]; var elem = $("<li>"); var link = $("<a>"); var handle = artist.foreign_ids[0].foreign_id.replace('twitter:artist:', ''); link.attr('href', 'http://twitter.com/' + handle); link.text(artist.name); elem.append(link); $("#results").append(elem); } } }); }
The key bits here are creating the artist/top_hottt request to The Echo Nest and adding the id:twitter bucket and setting limit to true. This tells the Echo Nest to include the twitter handle information in the results and limit the results to only those artists that have twitter information. After that it is just pulling the data out of the results and formatting it for the lovely display. The Twitter ID info is returned in an ID block that looks like this:
{"catalog": "twitter","foreign_id": "twitter:artist:LMFAO"}
Note that the Twitter ID is returned in a URN form. To get the actual Twitter URL for an artist we just need to replace the ‘twitter:artist:’ bits with ‘http://twitter.com/’.
You can see the app here: Top 100 artists with verified Twitter accounts. As you can see, I tried to make the web app as ugly as possible. The only thing it needs is some Comic Sansification. The code is available for detailed study in this gist.
#recsplease – the Blip.fm Recommender bot
Posted by Paul in Music, recommendation, The Echo Nest, web services on May 5, 2009
Jason has put together a mashup (ah, that term seems so old and dated now) that combines twitter, blip.fm, and the Echo Nest. When you Blip a song, just add the tag #recsplease to the twitter blip and you’ll get a reply with some artists that you might like to listen to.
This is similar to recomme developed by Adam Lindsay but recomme has been down for a few weeks, so clearly there was a twitter-music-recommendation gap that needed to be filled.
Check out Jason’s Blip.fm/twitter recommender bot.
Yet another twitter music app – song.ly
song.ly is an app that lets you post songs on twitter. Here’s what you do:
- Go to song.ly
- Search for a song that you want to tweet. The catalog seems pretty big, so you’ll find most popular songs, and many unpopular ones – for instance, I had no problems finding a track by Winter Gloves, an Indie band from Montreal.
- When you find the song click on ‘tweet’ – you are brought to your twitter page with your status filled in with a tiny url pointing to your song.
- Add whatever words you want to your tweet – and hit update
- Anyone can listen to the song by clicking on your tweet
The really neat thing about song.ly is that you don’t have to register or login to do any of this. It just works. There’s also a firefox plugin that lets you share a track with two clicks: right click a music file, select ‘Song.ly: Share this song’ and your are done. Song.ly also has an API that lets you shorten/expand Mp3 urls to the song.ly short form.
I like the low impact model of Song.ly – I don’t have to register or login. If I want to tweet a song I just right click and go. Nice and easy.
Via The Echo Nest
the sound of a million passwords changing
A bad day for my friends at Spotify. First the news of a security breach that compromised the personal information of their one million users – followed by the outage of the Spotify.com website as a million people all tried to change their passwords at once. But despite all of this trouble, the Spotify player kept playing music.
It is interesting to see how Spotify is handling their first big crises. So far, they seem to be doing most things right – they are being open about what the problem was and they have already fixed the problem that has caused the breach. Looks like they may need to be a bigger web server though.
Twisten.fm – Music gone viral.
Posted by Paul in Music, recommendation on February 13, 2009
The fine folks over at Grooveshark have just released Twisten.fm. Like Blip.fm, Twisten.fm combines micro-blogging and music, and like Blip.fm, instead of creating an entirely new microblogging network, Twisten.fm piggybacks on top of the existing Twitter network.
With twisten, you can make tweets with just about any song in the world (Grooveshark has millions of tracks in its catalog) – twisten will automatically generate a twisten tiny url to the song, and if any of your twitter followers click on the link, they are taken directly to the song page on Grooveshark where they can listen to the song.

twisten a song
Here’s what the song tweet looks like on twitter:
Twisten makes it easy for you to tell your twitter followers that you like a song – with Twisten, you just type the name of the song, and twisten does all of the hard work of finding the song in the catalog, generating a tiny URL for the song and posting it to Twitter.
Twisten also makes it easy to listen to music posted by others. If you use the Twisten web app, you can easily listen and browse all of the twisten tweets of your followees or the world at large.

Listening to Twisten tweets
With the twisten app, you just see the Twisten tweets, which makes it a perfect app for browsing through new music. It is easy to listen, since the player is embedded right in the page. You can also listen to the music that is being posted by everyone.
I suspect that Twisten.fm is going to be a really big deal. First and foremost, it is an incredibly viral app. Just by using Twisten, you are telling all the world about it. 18 hours after it’s release, Twisten is #6 on the list of Twitter trending topics.
Second, it doesn’t re-invent the wheel. Instead of building a whole new social network, it sits on top of Twitter, one of the largest existing social networks – it doesn’t have to build up a network from scratch.
Twisten is really neat, I like it a lot – still, there are a few places where it could be improved.
First of all, when listening to music on the Twisten site, the music should never stop when I navigate to a different part of the site. Right now, if I’m listening to a particular tweet, and decide to check out what ‘everybody is listening to’, the music stops. The main Grooveshark app does a much better job of keeping the music playing all the time whilst one navigates through the site.
Currently, when I click on a twisten tiny url in twitter to listen to a song, instead of taking me to Twisten, the URL takes me to Grooveshark. I understand that Grooveshark is hosting all of the music, but it seems to me that if you want to really make Twisten go viral, the links should bring listeners straight to Twisten, where they can listen to the music, and while there, start Twisten their own tweets.
The listening experience on Twisten is a hunt-and-peck style. I see a song, I click on it, I listening to it, and then I go and find the next song. That’s fine when I am exploring for new music, but if I just want to listen to music, I’d like to be able to turn Twisten into a radio station, where I listen to the music that my friends have been twittering. Ideally, I should be able to listen to tweets all day without having to click a mouse button. TheSixtyOne does a great job of keeping the music flowing. Twisten should follow their model.
I wish Twisten.fm would scrobble all my tweets and listens – it’d be great if every music app in the world scrobbled my listening behavior.
Twisten is able to collect all sorts of interesting information about who is listening to what music. I hope they do some interesting things with this data. For instance, they could create a Twitter Music Zeitgest that shows the songs and artists that are rising, popular, or falling. Since Twisten knows what I’ve been listening to, and what I like (because I can ‘favorite’ twisten songs), Twisten should be able to connect me up with other Twisten listeners that have similar tastes so I can use their twitters and listens to guide my own listening. Twisten is going to be able to collect lots and lots of user listener data, so it should be interesting to see what they do with it all.
Twisten has the potential to be the real breakout music application of 2009. It has all the ingredients – a huge catalog of free music, and a viral model that leverages one of the largest and most active social networks. When iLike released it’s facebook app, iLike became the fastest growing music app ever, adding 3 million users in two weeks. Twisten has a good chance to do the same thing.
The Blip.fm API
Posted by Paul in Music, web services on February 10, 2009
Blip.fm is often described as a twitter for music. Blip users post ‘blips’ to tracks – and as with Twitter, others can follow your Blips and listen to what you’ve posted. It’s micro-music-blogging. Now that Twitter has become so popular, there is a whole micro-economy built around Twitter – with multiple companies providing every different style of twitter client that you could possibly want, for just about any platform. Twitter has enabled this economy by providing a rich set of web services around their system that any client can tap into. Blip is hoping to do the same thing. They are providing a rich set of web services around their core that allows any third party to interact with the Blip service.
The current Blip web services are in private beta – and are likely to be extended and modified as the service matures. To use the web services you need to get an API key from blip.fm (via email). Despite the private beta nature of the API – there’s already quite a bit a functionality in the API. Here’s a quick rundown of what you can already do with the API:
- Post a blip
- Delete a blip
- Get a blip by ID
- Get all public blips that occurred over a range of time
- Search for by song or artist name
- User Related Blips
- Get blips for a user ordered by recency
- Get blips for users that a user is following
- Get a user’s playlist blips
- Get blips that have replies
- Get a user by name
- Get a user’s listeners
- Get a user’s preferences
- Get a user’s stats
- Give a user ‘props’
- Save a user’s preferences
- Sign up a new user
- Favorites
- Add a user as a ‘favorite’ dj
- add a blip to a user’s playlist
- remove a user as a a ‘favorite’ dj
- remove a blip from a user’s playlist
- Get a user’s favorite DJs
These services seem to be pretty all inclusive, covering every thing that any 3rd party client would want to do with the blip service.
The Blip services provide output in XML, JSON or serialized PHP. There’s a sample return for a getUserProfile request that returns my most recent blips at the end of this post.
Authentication – In general, any of the Blip web services that are related to a specific user require the call to be authenticated. Creating an authenticated call involves taking a hash of your blip secret key along with a few other fields (such as the timestamp) to create a signature that is appended to the request. (Does anyone else have problems trying to manage these secret keys in an open source project?, they really belong with the code, but if you check them into your open source code repository, they are not secret anymore!).
Terms-of-service – As far as I can tell, the Blip folks haven’t published a terms-of-service for the API. Not surprising since the API is still in private beta. Still, I like to know the rules of the road before I invest too much in an API. In particular, I’d like to know whether or not commercial use of the API is allowed. Blip does have rate limits – no more than one call every 30 seconds per API key for authenticated calls (there are some calls that are excluded from this rate limit).
Documentation – the documentation for the blip service is quite good for a private beta. I especially like the API Tool that lets you play with the API in the browser. They could improve the documentation a bit around what happens with failures – all they say for right now is Error message on failure – which is really not that helpful. In particular, it would be nice if they published a set of status codes that one could expect on error – so I can programmatically tell the difference between an authentication error (a user gave me the wrong password) and a rate limit exceeded error.
Summary – For a private beta, I’m quite impressed at how full featured the Blip.fm API is. They have a wide range of web services already built around their core system. They have figured out a good way to authenticate calls that manipulate user data. The documentation combined with the nifty API tool lets you easily explore the nooks and crannies of the API. They have API client libraries for PHP, Actionscript and Javascript (no Java or Python, sniff!). There’s lots of good stuff here.
Sample Blip return XML <?xml version="1.0" encoding="UTF-8"?> <BlipApiResponse> <status> <code>200</code> <message>OK</message> <requestTime>1234265571</requestTime> <responseTime>1234265571</responseTime> <rateLimit>0</rateLimit> </status> <result> <total>2</total> <offset>0</offset> <limit>25</limit> <count>2</count> <collection> <Blip> <id>16946</id> <url>http://centralvillage.blogs.com/cv/files/vampireweekend_oxford_comma.mp3</url> <ownerId>37237</ownerId> <artist>Vampire Weekend</artist> <title>Oxford Comma</title> <insTime>2008-06-17 12:12:38</insTime> <message>vw</message> <unixTime>1213704758</unixTime> <toId /> <type>songUrl</type> <status>active</status> <reblipId /> <thumbplayLink /> <via /> <viaUrl /> <owner> <id>37237</id> <urlName>plamere</urlName> <profilePic>http://blip.fm/_/images/nousericon.gif</profilePic> <status>active</status> <propsCount>0</propsCount> <countryAbbr>us</countryAbbr> <name /> <website /> <timeZone>US/Pacific</timeZone> <lastBlipTime>0000-00-00 00:00:00</lastBlipTime> <insTime>2008-06-17 09:18:28</insTime> <updateTime>2009-02-05 12:40:39</updateTime> </owner> </Blip> <Blip> <id>16919</id> <url>http://www.notontheguestlist.com/MynameIsjonas.mp3</url> <ownerId>37237</ownerId> <artist>Weezer</artist> <title>My Name Is Jonas</title> <insTime>2008-06-17 09:19:26</insTime> <message>weezer in the morning</message> <unixTime>1213694366</unixTime> <toId /> <type>songUrl</type> <status>active</status> <reblipId /> <thumbplayLink /> <via /> <viaUrl /> <owner> <id>37237</id> <urlName>plamere</urlName> <profilePic>http://blip.fm/_/images/nousericon.gif</profilePic> <status>active</status> <propsCount>0</propsCount> <countryAbbr>us</countryAbbr> <name /> <website /> <timeZone>US/Pacific</timeZone> <lastBlipTime>0000-00-00 00:00:00</lastBlipTime> <insTime>2008-06-17 09:18:28</insTime> <updateTime>2009-02-05 12:40:39</updateTime> </owner> </Blip> </collection> </result> </BlipApiResponse>