25 November 2009

Spotify on Ubuntu 9.10 (Karmic Koala)

Yep. It works fine (thanks to Juhis for the invite)!

Spotify is a subscription-based streaming music network. I'll not go into all the details of what they offer here, you can read about that on their site: www.spotify.com, but I will add a little to their instructions on getting their application working under Linux, more specifically for the variant of Linux I've been working with for the past week or so, Ubuntu Linux 9.10, aka "Karmic Koala".

There are only versions of the Spotify application for MacOS 10.4 or later, or Microsoft Windows XP or later, but the fine folks at Spotify also point out that it will work on a Linux system using the WINE (WINE Is Not an Emulator) Microsoft Windows Compatibility layer. See this FAQ entry on Spotify's site.

The instructions given there are for a generic Debian setup. Ubuntu is indeed based on Debian, but there are a few things built in to it that make life easier for users.

The first thing we're going to do differently is the installation of WINE itself. It's already in the main Ubuntu repositories so its installation is no more than a few clicks away.

Go in to the "Applications" menu on your desktop and select "Ubuntu Software Centre". There will be a search box at the top-right of the application window that will appear. Type "wine" in that search box. You should see something like this (click on the image to enlarge it):


Click on "Wine Microsoft Windows Compatibility Layer" (note that there's a tick on a green background in this screenshot because WINE is already installed on my system) and then on the yellow arrow to the right. You will be prompted to click on an "install" button for the software to be pulled down and installed. After a few seconds, or maybe longer depending on the speed of your internet connection and your machine, you will be informed that the installation was successful.

Next, we need to tell WINE how to use the sound hardware. The default settings do work after a fashion, but you get far better results by asking WINE to use the old OSS (Open Sound System) method to output sound. For this, press Alt-F2. In the "Run application" box that will appear, type winecfg and hit the enter key. It'll take a few seconds for WINE to fire up and show you its setup application. Click on the "Audio" tab and select just the OSS driver as illustrated here (click on the image to enlarge it):


Click on the "Test Sound" button. You should hear something in your speakers.

Click on the "OK" button to save this setting and dismiss the window.

Next, we have to download the Spotify application itself.

Right-click on the link below and choose "Save link as...". Save it on your desktop.

http://www.spotify.com/download/spotify.exe

There will now be a Windows executable file, spotify.exe, on your desktop. You should now move it to its rightful place within the filesystem set up by WINE to mimic a Windows machine's hard disk.

Go into the "Places" menu on your desktop and select "Home folder". In order to access WINE's files we need to access a hidden directory. There are many hidden objects in your home directory so we'll simply use a trick to enter a hidden directory of which we know the name. On the left hand side of the location bar you'll see an icon that looks like a pencil. Click on it. The buttons representing where you are in the machine's filesystem are replaced with a text input box containing something like:

/home/[username]

Add "/.wine" onto the end of this so that it now reads:

/home/[username]/.wine

Press enter and click on the "pencil" icon again.

Double-click on "drive_c" to enter that folder, then on "Program Files".

Right-click in this window and select "Create folder". Name the folder "Spotify". Double-click on it to enter it.

Grab that spotify.exe file on your desktop and drop it in this newly-created folder.

You can now close the file manager window.

The last thing to do is create a shortcut on the desktop that will launch Spotify.

Right-click on the desktop and select "Create launcher..."

Put "Spotify" in the "Name" field, and enter this in the "Command" field:

wine "C:/Program Files/Spotify/spotify.exe"

See screenshot (click to enlarge):

That's it, click on OK and you're done.