How i made Spotify 0.4 play local mp3 files on Linux with Wine
by espen on Apr.27, 2010, under Hack, Linux, Nerd, Spotify
This is a very short, and “simple” explanation how i made Spotify 0.4 play local MP3 files under Linux with Wine.
I have not tested this elsewhere, and i can not guarantee that everyone has to do the same steps as me.
If you want to try my finished file you can download it here: winemp3.acm.so (x86 only)
Place it in /usr/lib/wine/ (x86) or /usr/lib32/wine/ (x64).
Or if you need to do things a tad more automatic you can try this script which will do everything automatically for the ones of you on x86: winefix.sh
For those of you who want the technical details: continue reading
You should try and skip step 3 if possible, but if Spotify just hangs and max out your CPU you should do step 3.
You can also use an hex editor to change WINE-MPEG3 to LAME-MPEG3 in /usr/lib/wine/winemp3.acm.so to try before doing the, for me, crucial step number three.
Step 1: Download the wine source code.
Step 2: run configure to create the appropriate Makefiles
Step 3: edit dlls/winemp3.acm/mpgl3.c and change the following:
if (dpos > *ndst) break;
} while (ret != MPG123_ERR && ret != MPG123_NEED_MORE);
*ndst = dpos;
To this:
if (dpos >= *ndst) break;
} while (ret != MPG123_ERR && ret != MPG123_NEED_MORE);
*ndst = dpos;
Step4: Change the following:
add->cFilterTags = 0;
add->hicon = NULL;
MultiByteToWideChar( CP_ACP, 0, "WINE-MPEG3", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
To this:
add->cFilterTags = 0;
add->hicon = NULL;
MultiByteToWideChar( CP_ACP, 0, "EFO", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
Step 5: Run make to compile the new codec.
Step 6: copy the codec to /usr/lib/wine/ (ubuntu atleast)
Step 7: Run Spotify and enjoy.
This worked for me, but it is not recommended as i changed some code in the MP3 library in Wine.
If you use Wine with other programs which utilizes the mpeg3 library they might break.
UPDATE 1: It seems like my hack will give some problems with automatic changing of songs. The codec does not understand that the song is finished, and will just generate noise.
UPDATE 2: Ok, new fix. This time it does infact end where it should, and continues to the next track. Step 3 is updated. Same with the binary file, and scripts.
UPDATE 3: Moved around some text in this post.
20 Comments for this entry
2 Trackbacks / Pingbacks for this entry
-
Tweets that mention How i made Spotify 0.4 play local mp3 files on Linux with Wine | Yonder thoughts -- Topsy.com
April 28th, 2010 on 2:30 pm[...] This post was mentioned on Twitter by Anders "Lon, Espen Fjellvær Olsen. Espen Fjellvær Olsen said: How i made Spotify 0.4 play local mp3 files under wine : http://wp.me/purI1-K [...]
-
Divide and Conquer » Blog Archive » Spotify 0.4 in WINE: “File is an unsupported format”
May 7th, 2010 on 8:08 pm[...] workaround I found involved recompiling or binary-patching WINE. Not so [...]

April 28th, 2010 on 11:29 pm
Thanks for publishing this! I haven’t tried out yet but hope to be able to test it soon!
April 29th, 2010 on 3:38 pm
Hello!
I have opened the file winemp3.acm.so in an HEX-editor, but how do you mean I should change WINE-MPEG3 to LAME-MPEG3, I can’t even find something that looks like WINE-MPEG3?
April 29th, 2010 on 6:50 pm
Martin: Here, the value was at offset 0001:2A08.
Search for WINE-MPEG3.
It is towards the end of the file after a big gap of nothing (00000000) and some binary data.
April 29th, 2010 on 3:52 pm
I love you!
Thank you so very very much, now everything is just perfect. =)
April 29th, 2010 on 5:27 pm
I have to say script is not working for me, Spotify’s error message:” there’s a problem with your sound decoder”.
Anyways, Good Job!!!
April 29th, 2010 on 6:49 pm
John: That error comes when wine have problems finding an mp3-library at all.
What version of wine are you running?
(dpkg -l wine).
April 29th, 2010 on 6:31 pm
Great, thanks! On my Ubuntu 9.10 64-bit system I had to change the name “lib” to “lib32″, it worked with this command:
sudo wget http://blog.mrfjo.org/winemp3.acm.so -O /usr/lib32/wine/winemp3.acm.so
April 29th, 2010 on 11:21 pm
Espen: I’m running this wine version: 1.0.1-0ubuntu8 on Ubuntu 9.10. Before using the script at least I could listen “streaming-songs” and if I reinstall wine , spotify runs like before : sound in “streaming-songs” but no sound in local. Any suggestion?
Thanks for all and have a nice time.
April 29th, 2010 on 11:49 pm
I have solved the problem using another way, I know it’s not the best one but it has solved my problem
Here is :
“Another solution is to replace the built-in winemp3.acm.so with another driver. Use with caution. Some MP3s will consistently crash Spotify, because either the length of the track or the position is misreported. So when you reach the end of some songs, Spotify hangs in a busy wait loop, expecting more data from the codec, ending up eating all your CPU.
Here’s the override if you don’t mind some crashing:
1. The easiest way to get the driver is to install WMP10: http://www.microsoft.com/windows/wind...
2. Copy ~/.wine/drive_c/windows/system32/l3codecp.acm to ~/.wine/drive_c/windows/system32/winemp3.acm
3. Open Wine Config. Go to the Libraries tab. Under “New override”, enter “winemp3.acm” and click Add.
Start Spotify. Now your local files should play. ”
It’s taken from: http://getsatisfaction.com/spotify/topics/spotify_under_wine_unable_to_playback_local_files#reply_2336829
Thanks for all and have a nice time
April 30th, 2010 on 10:49 am
Thanks! The automatic fix worked for me on Debian unstable 32-bit.
May 1st, 2010 on 12:15 am
wonderful!
Works.. !
Thanks a LOT man!
May 3rd, 2010 on 1:50 pm
This sounds really odd, but this workaround worked properly this morning, but now it suddently stopped working. Same error message is showing up in spotify again, and I have to switch between Spotify and Rhythmbox again to listen to tracks on my computer -.-
May 3rd, 2010 on 1:57 pm
Oh… I forgot to add, that .mp3 files still work but .m4a files stopped suddently playing after several hours of listening to them.
May 3rd, 2010 on 4:56 pm
Managed to get Wine to play local files on OpenSUSE 11.2 using your solution. Great!
BUT, it did not work on Ubuntu. I found this:
http://getsatisfaction.com/spotify/topics/spotify_under_wine_unable_to_playback_local_files
It works great, and is a much easier solution. If you already have a Windows-partition you already have the file “l3codecp.acm” in system32 so just copy it and rename it as described.
May 4th, 2010 on 10:22 pm
Thanks. It worked fine, although I had to add the file to /usr/local/lib/wine instead of /usr/lib/wine because my Wine was built from source
May 6th, 2010 on 9:07 pm
Ubuntu 10.04 64 bit here. Your file worked fine.
I get a very short (~0,1 sec long) static noise before each local file starts playing, but beyond that it’s all good. Does anyone else get that too?
Anyway… this is waaaaaaay better than not being able to play local files at all!
Thanks!
May 18th, 2010 on 2:19 am
I get that short noice before starting a song as well. I’m running Ubuntu 10.04 32-bit.
May 18th, 2010 on 1:33 pm
Thanks this worked for me!
June 14th, 2010 on 4:56 pm
Super great writing! Honestly!
July 16th, 2010 on 5:19 pm
thanks, i will try it