Sam Rayner

Hi, I’m Sam. I design and build apps for iOS and the web. I live in Sheffield, UK and play Ultimate far too much. You can reach me via email or on Twitter.

Discographer

As a fun little project over the last few weeks, I’ve built a Web app that helps you discover more music by artists in your iTunes library. It’s called Discographer, and uses the Spotify API to fetch albums, ticking off the ones you own so you can see what you might have missed.

iTunes Music Library.xml

It was a nice opportunity to play with some new web APIs (Drag and Drop, File and Flexbox), the main benefit being your library is never uploaded but parsed locally in your browser. The only thing transmitted is the name of any artist you click.

It was linked on Lifehacker a couple of days ago and I’ve since received some great feedback. Please give it a go and let me know what you think!


Alfred Lyrics Search Workflow

Ever had the lyrics of a song stuck in your head but can’t for the life of you remember the artist or title? I get it all the time so wrote this Alfred workflow to search my iTunes library and start playing the first match it finds.

Download Lyrics Search

Get Lyrical

To get it working with your music collection you’ll need to make sure all of your tracks have lyrics downloaded for them. Don’t panic though, a great little Mac app called Get Lyrical can automate the process, tagging songs you select or tagging in the background as you play them.

Once your library is tagged with lyrics, install the workflow and type sing followed by the lyrics.

Under The Hood

For those interested in the technical side, the Workflow is just an Applescript:

on normalize(theString)
  --trim everything but letters and numbers
  return do shell script "echo " & quoted form of theString & " | tr '\r' ' ' | sed 's/[^[:space:][:alnum:]]//g'"
end normalize

tell application "iTunes"
  set theQuery to my normalize("{query}")
  --playlist 1 should be your whole music library
  set theTracks to tracks of library playlist 1
  set match to ""
  
  repeat with i from 1 to number of items in theTracks
    set theTrack to item i of theTracks
    set theLyrics to my normalize(lyrics of theTrack)
    if theQuery is in theLyrics then
      set match to (artist of theTrack & " - " & name of theTrack)
      exit repeat
    end if
  end repeat
  
  if match is not "" then
    play theTrack
    get match
  else
    get "No match found"
  end if
end tell

You’ll notice that it runs through your entire library in alphabetical order. Unfortunately, if the song you’re looking for is by ZZ Top the search is going to be a hell of a lot slower than if it were by ABBA.

Also, lyrical clichés like “oh baby” or “tell me why” are likely to produce a match earlier than you expect so try to search for longer or less common phrases.1

If anyone has suggestions for improvements please let me know. I like the simplicity of the script so don’t plan to produce a playlist of search results or anything like that but feel free to use the Applescript as a starting point for your own script!

  1. It’s actually pretty fun to guess at lyrics and see what songs they appear in. If a search for “hands in the air” or “in da club” return in less than 10 seconds your iTunes may be due a clear-out.


Shushify

Spotify is a great service but I don’t use it anywhere near enough to warrent paying £10 a month for a Premium subscription. I only use the app occasionally to check out a band I’ve had recommended before buying their album on iTunes or leaving it.

I do use Spotify just enough for the ads to get annoying though. To get around hearing them, I created a simple Mac app called Shushify.

Shushify icon Download Shushify

To listen without ads, just launch Shushify.app instead of Spotify.app. Spotify will open as normal but when an advert begins to play Shushify will temporarily mute your Mac’s audio.

Shushify works by querying Spotify for track info every time a new one starts playing (and every few seconds for good measure). The process will quit when you quit Spotify.

You’ll still get an awkard silence for the duration of adverts but that’s good enough for me. If you find yourself using Spotify a lot, please consider paying for a subscription; it really is a great service.

Shushify is offered as-is, unsupported. There’s a good chance Spotify will break it in the future but hopefully it’ll come in handy for some people until then.

Post Archive

2016

2015

July

2014

February