Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Finally got sound working in Linux DF  (Read 6363 times)

vyznev

  • Bay Watcher
    • View Profile
Finally got sound working in Linux DF
« on: January 31, 2011, 07:07:46 pm »

As I finally managed to get sound working in DF v0.31.18 under Linux/KDE, I thought I'd post the instructions here for others to find.

As it happens, there were two problems.  The first was the DF wasn't loading the OpenAL libraries, giving an annoying dialog box and the following messages to the console:
Code: [Select]
Dynamically loading the OpenAL library failed, disabling sound
Initializing OpenAL failed, no sound will be played

Using the instructions from this thread, I solved the problem like this:
Code: [Select]
$ ln -s /usr/lib/libsndfile.so.1 df_linux/libs/libsndfile.so
$ ln -s /usr/lib/libopenal.so.1 df_linux/libs/libopenal.so

The second problem was that OpenAL was picking PulseAudio instead of ALSA as the output device, and failing for some reason like this:
Code: [Select]
Sound devices available:
PulseAudio Software
ALSA Software
OSS Software
Picking PulseAudio Software. If your desired device was missing, make sure you have the appropriate 32-bit libraries installed. If you wanted a different device, configure ~/.openalrc appropriately.
Initializing OpenAL failed, no sound will be played

Annoyingly, while the message suggests editing .openalrc, that doesn't actually do anything. >:(  Apparently, that config file is no longer used in modern versions of OpenAL.  Or something.  What did work, however, was:
Code: [Select]
$ echo "drivers = alsa," > .alsoftrc

Now OpenAL is using ALSA, and I can listen to the relaxing plink-plonk of the DF theme to my heart's content. :D
« Last Edit: September 03, 2011, 09:51:23 am by vyznev »
Logged
Climbing is a strength-based skill. Elephants are very strong. Why are you surprised?

claer_runway

  • Bay Watcher
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #1 on: February 01, 2011, 12:45:57 am »

you spent all this time trying to get sound working? in DF?

you do realize you could just play the music files, right?
Logged
You can't program common sense.

like Skies of Arcadia?:
http://www.youtube.com/user/clearrunway

Cassicotca

  • Bay Watcher
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #2 on: February 01, 2011, 12:51:20 am »

But its not the same thing  ;) DF works now in linux as good as in windows?
Logged

claer_runway

  • Bay Watcher
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #3 on: February 01, 2011, 01:15:13 am »

also, and this might just be my experience, but the Linux version of df doesn't seem to be that well programmed. my fps is roughly the same just using WINE (in which it runs flawlessly)
Logged
You can't program common sense.

like Skies of Arcadia?:
http://www.youtube.com/user/clearrunway

Jake

  • Bay Watcher
  • Remember Boatmurdered!
    • View Profile
    • My Web Fiction
Re: Finally got sound working in Linux DF
« Reply #4 on: February 01, 2011, 08:16:10 am »

Well done. Now turn the music off before the endless loop of the same track starts to annoy you.
Logged
Never used Dwarf Therapist, mods or tilesets in all the years I've been playing.
I think Toady's confusing interface better simulates the experience of a bunch of disorganised drunken dwarves running a fort.

Black Powder Firearms - Superior firepower, realistic manufacturing and rocket launchers!

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #5 on: February 01, 2011, 09:05:08 am »

also, and this might just be my experience, but the Linux version of df doesn't seem to be that well programmed. my fps is roughly the same just using WINE (in which it runs flawlessly)
This is because Wine only intercepts graphics and other system API calls (slowing them down), but doesn't touch the performance of anything the program does internally. The vast majority of the time DF uses is in internal code, slowing the graphics makes little difference.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Cassicotca

  • Bay Watcher
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #6 on: February 01, 2011, 09:59:06 am »

So almost as good as windows version or equal?
Logged

trousermonkey

  • Bay Watcher
    • View Profile
    • http://trousermonkey.dyndns.org
Re: Finally got sound working in Linux DF
« Reply #7 on: February 01, 2011, 03:07:27 pm »

Awesome!  Thank you.

I hate how audio is always such a PITA in linux.

I'm looking at you pulseaudio >_>
Logged

Ulde Ilrekor

  • Escaped Lunatic
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #8 on: April 14, 2011, 09:55:31 am »

you spent all this time trying to get sound working? in DF?
all which time? Oo
Logged

Ulde Ilrekor

  • Escaped Lunatic
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #9 on: April 14, 2011, 10:09:24 am »

Thank you vyznev for guide, I'd like to post some comments and hope you edit first message to correct the tutorial.

Code: [Select]
$ ln -s /usr/bin/libsndfile.so.1 df_linux/libs/libsndfile.so
$ ln -s /usr/bin/libopenal.so.1 df_linux/libs/libopenal.so
For me (on Ubuntu) these files were in /usr/lib. It would be strange for libraries to be in /usr/bin :)

Code: [Select]
$ echo "drivers = alsa," > .alsoftrc
I think it's better to copy /etc/openal/alsoft.conf to .alsoftrc, and then uncomment and edit appropriate lines (a lot of info is in this file). I had a problem with ALSA stating incorrect periods argument, so I found it easier to choose OSS (which is still emulated through ALSA). Then there was another problem - after DF startup all other programs couldn't output sound.

If anyone could give a hint on solving any of these two problems (either with ALSA or with OSS), I'd be gratefull as well.
« Last Edit: April 14, 2011, 10:12:50 am by Ulde Ilrekor »
Logged

bremarv

  • Bay Watcher
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #10 on: April 15, 2011, 10:38:50 am »

Code: [Select]
$ ln -s /usr/bin/libsndfile.so.1 df_linux/libs/libsndfile.so
$ ln -s /usr/bin/libopenal.so.1 df_linux/libs/libopenal.so
For me (on Ubuntu) these files were in /usr/lib. It would be strange for libraries to be in /usr/bin :)
I got those two in my /usr/lib/ as well (arch linux).

Code: [Select]
$ echo "drivers = alsa," > .alsoftrc
I think it's better to copy /etc/openal/alsoft.conf to .alsoftrc, and then uncomment and edit appropriate lines (a lot of info is in this file). I had a problem with ALSA stating incorrect periods argument, so I found it easier to choose OSS (which is still emulated through ALSA). Then there was another problem - after DF startup all other programs couldn't output sound.

my crappy, "this works so I haven't bothered to find a real solution" solution is to start youtube video in firefox, which also makes the other programs respect the alsa pcm volume.
Logged
the future isn't the present on steroids. The future is a mutated bacteria that you never saw coming. - Annalee Newitz
there are certain rooms that should not have lava moats. Namely danger room, and daycare rooms.
I prefer dwarves for some things. Like not laying eggs.

thermite

  • Escaped Lunatic
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #11 on: April 15, 2011, 04:25:26 pm »

I'd like to mention that Soundsense gives rather nice sounds for DF on linux because that is what I use. It gives you sounds for all the various events you have so you can hear when you hit a new type of rock or when someone is having their body parts sail off in an arc. I detail a couple things to make Soundsense run properly here http://www.bay12forums.com/smf/index.php?topic=60287.msg2170327#msg2170327

I can sympathize with Pulseaudio giving you problems having run killall pulseaudio one to many times but for me DF and pulse always seemed to get along. Windows unfortunately seems to lack any commands with the word kill in them.
Logged

AdiRat

  • Escaped Lunatic
    • View Profile
Re: Finally got sound working in Linux DF
« Reply #12 on: March 29, 2012, 08:35:48 pm »

Just a quick update for those running the latest version of Ubuntu (I'm running 12.04 now, should work for all who are still supported by Canonical).

To fix the problem make sure libopenal1 is installed

Code: [Select]
sudo apt-get install libopenal1
After which the library you're missing is /usr/lib/i386-linux-gnu/libopenal.so, so do the following

Code: [Select]
ln -s /usr/lib/i386-linux-gnu/libopenal.so /usr/lib/libopenal.so
if the sould still doesn't work, do the following in your game root directory

Code: [Select]
ln -s /usr/lib/i386-linux-gnu/libopenal.so libs/libopenal.so
And the sound should work
« Last Edit: March 29, 2012, 08:42:35 pm by AdiRat »
Logged