Monday, July 18, 2011

Spotify vs. pulseaudio: workaround

I use to run Spotify on linux under wine. It's quite esasy to install, and it works great, and almost out of the box. At least sometimes. I've been running spotify over wine on several installations and sometimes it works just fine, sometimes not, I still don't know what's the difference (didn't have the time to investigate any further). And even sometimes it stops working suddenly, again, who knows why exactly.
Anyway, it doesn't seem to integrate fine with pulseudio. I mean wine, not spotify itself. So the workaround I am using is to start Spotify killing the pulseaudio server (I'm always running it on a per user instance, not daemonized by root).
So the startup command is something like:

Exec=pulseaudio --kill; env WINEPREFIX="" wine "C:\\Program files\\Spotify\\spotify.exe"


Check out the desktop icon that wine creates when you make a regular install; edit the file and change/add the pulseaudio --kill sentence.

As I said, sometimes nevertheless Spotify stops working. I have no workaround for that yet, just have to restart Spotify again. It can be a little annoying. I'm pretty sure there's already a definite solution for that out there (please, somebody tell me if you know ;)).

Tuesday, July 12, 2011

Sound problems on kubuntu 11.04

...yeah, suddenly I had no more sound on Kubuntu 11.04. It had been working up until now, a couple of months after a fresh install, but now sound is gone. I hate this! Yeah, I know KDE on Kubuntu is somewhat buggy, but I like it nonetheless.
However, on Debian I use to take a wonderful script for such situations (yes, sometimes it happened on Debian too), which was /usr/sbin/alsaconf shipped with alsa-utils. But for some reasons I don't know it isn't there anymore, at least not in Kubuntu 11.04. Uninstalling every single kernel module with modprobe -r is a bad idea. What to do?
Hey, there's this other tool, simply /sbin/alsa:

# alsa
Usage: /sbin/alsa {unload|reload|force-unload|force-reload|suspend|resume}


and this works fine, but for one reason: if fails to unload some modules because they're in use, even if I use the force-unload option. Why is that? Because for some reason the '/usr/bin/pulseaudio' is being restarted very fast, before it manages to unload all modules. The trick, although a little ugly:

# chmod a-x /usr/bin/pulseaudio
# alsa force-reload


...And there they are again my sound devices in System Preferences -> Multimedia!

Of course, don't forget to make pulseaudio executable again.