Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old March 19, 2016, 08:19   #1
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Getting sound to work in Linux

After a VERY long break from Angband, I have decided to once again brave Morgoth's halls.

I'm running a fairly stock Fedora 23 Linux installation.

I cloned the latest git repository and managed to get Angband compiled (with SDL support) in pretty short order. But I'm having a major problem getting sound to wotk.

My first run was met with a stream of the following:

./src/angband: Unrecognized music format: No such file or directory

I've tried installing all manner of MP3 players and libraries to no avail.

I then downloaded The Dubtrain Angband Sound Pack, v3.1.0 which is an archive of raw WAV files and replaced the sound.cfg file to suit (taking a backup of the original mp3 version of course). Using the WAV files, Angband crashes:

*** Error in `./src/angband': double free or corruption (!prev): 0x0000000001b7cae0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x77da5)[0x7f735fb6ada5]
/lib64/libc.so.6(+0x804fa)[0x7f735fb734fa]
/lib64/libc.so.6(cfree+0x4c)[0x7f735fb76cac]
/lib64/libc.so.6(fclose+0x103)[0x7f735fb60aa3]
/lib64/libSDL-1.2.so.0(+0x10619)[0x7f7360a57619]
/lib64/libSDL_mixer-1.2.so.0(Mix_LoadWAV_RW+0x11e)[0x7f73601bdffe]
./src/angband[0x4ee987]
./src/angband[0x4eed16]
./src/angband[0x4e1d2d]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7f735fb13580]
./src/angband[0x4042b9]

I'm more than happy to help debug and fix the issue (I have a fair level of code and git experience), but before I start banging my head against the code, I'm wondering if anyone has any pointers
calris is offline   Reply With Quote
Old March 19, 2016, 08:52   #2
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
I probably can't help with the concrete issue you're seeing, but if you could compile with debug information I'm sure a stack trace with line numbers would be appreciated .

Adding "-g" to CFLAGS in the makefile or doing "CFLAGS='-g' ./configure" to configure should do the trick.
AnonymousHero is offline   Reply With Quote
Old March 19, 2016, 10:54   #3
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Ok, the plot thickens...

As far as I can tell, Angband only supports SDL for sound. SDL needs smpeg to process mp3 files, but smpeg is ancient and does not seem to agree with the latest build chains (see http://forums.fedoraforum.org/showthread.php?t=33457) and the last release was 14 years ago.

Now angband uses Mix_LoadMUS() for MP3 files and Mix_LoadWAV() for wave files. But Mix_LoadMUS() cane load wave files (see https://www.libsdl.org/projects/SDL_..._mixer_55.html)

So I tried using forcing angband to treat wav file like MP3 files, but now it seems to hit a problem in my_strimp

my_stricmp (s1=s1@entry=0x7fffffffce00 "summon_angel", s2=s2@entry=0x0) at z-util.c:92

So I guess my next question is rather obvious... does anyone have sound working in Angband on a reasonably recent Linux setup?
calris is offline   Reply With Quote
Old March 19, 2016, 11:25   #4
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,864
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by calris View Post
So I guess my next question is rather obvious... does anyone have sound working in Angband on a reasonably recent Linux setup?
Well, I certainly don't - I use OpenSUSE, and have had no success getting an appropriate mp3 player to work. I would be very interested to hear if people using other distros are successfully using sound.

Sadly, if you ask a Linux expert, they will typically say something like "Why not use ogg?", which is unhelpful in this circumstance.

I'm sorry I don't have anything helpful to contribute. I have made a few attempts to get this sorted out, but not made much progress. I am very happy to test any possible solution you might find, and to implement any actual solution.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old March 19, 2016, 12:54   #5
redlumf
Scout
 
Join Date: Aug 2015
Posts: 25
redlumf is on a distinguished road
Quote:
Originally Posted by calris View Post
Ok, the plot thickens...
...

So I guess my next question is rather obvious... does anyone have sound working in Angband on a reasonably recent Linux setup?
I just downloaded 4.0.4 src. Sound works on kubuntu 14.04.4 LTS.

./configure --with-no-install --enable-sdl-mixer

./angband -mgcu -ssdl

Never had a problem with it.
redlumf is offline   Reply With Quote
Old March 19, 2016, 13:36   #6
redlumf
Scout
 
Join Date: Aug 2015
Posts: 25
redlumf is on a distinguished road
Quote:
Originally Posted by Nick View Post
...
Sadly, if you ask a Linux expert, they will typically say something like "Why not use ogg?", which is unhelpful in this circumstance.
...
Ok, go to your sounds directory.
Do this:
Code:
for f in *.mp3 ; do sox -v `sox "$f" -n stat -v 2>&1` "$f" `basename "$f" .mp3`.ogg; done
(btw, needs sox...install it if you don't have it)
If the above worked (ignore the warnings), you now have all your mp3 converted to ogg. (Also volume normalised cause I find the originals way to low on the volume side

Now, lets fix the sound.cfg
Code:
sed -i -- 's/.mp3/.ogg/g' sound.cfg
Done.

Enjoy your sounds in .ogg now.
redlumf is offline   Reply With Quote
Old March 19, 2016, 14:21   #7
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Quote:
Originally Posted by redlumf View Post
I just downloaded 4.0.4 src. Sound works on kubuntu 14.04.4 LTS.

./configure --with-no-install --enable-sdl-mixer

./angband -mgcu -ssdl

Never had a problem with it.
That is good news - at least there is no underlying bugs in the way the sound event system is set up. I was worried it might have suffered from bit-rot

I'm now working on a bit of a hack for raw ALSA support. It only supports a sample rate of 14400 and raw WAV files in the sounds directory at the moment.

It's been a long time since I've hacked Angband's source (way back in Ben's day - even before his massive overhaul). I was a bit worried about what I was getting into, but the sound subsystem is so elegent - it's a delight to play with the code

I've pulled out the parsing of the sound.cfg file and added callbacks into the sound module for loading of the actual sample files. Should make additional sound modules even easier to add
calris is offline   Reply With Quote
Old March 19, 2016, 14:47   #8
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Quote:
Originally Posted by redlumf View Post
Ok, go to your sounds directory.
Do this:
Code:
for f in *.mp3 ; do sox -v `sox "$f" -n stat -v 2>&1` "$f" `basename "$f" .mp3`.ogg; done
(btw, needs sox...install it if you don't have it)
If the above worked (ignore the warnings), you now have all your mp3 converted to ogg. (Also volume normalised cause I find the originals way to low on the volume side

Now, lets fix the sound.cfg
Code:
sed -i -- 's/.mp3/.ogg/g' sound.cfg
Done.

Enjoy your sounds in .ogg now.
You are a legend - had to install "sox-plugins-freeworld" to get sox to know about mp3, but after that, Angband sound works perfectly. Thank you.

For those interested in the arcane, the SDL sound module processes anything NOT mp3 as a wave. So it plays mp3 files as 'Music' and everything else as a 'Sample'. No idea what the difference is under the SDL hood. So I'm a bit mystified as to why installing the .wav sound pack didn't work...

Now I'm off to finish my ALSA port
calris is offline   Reply With Quote
Old March 19, 2016, 22:15   #9
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,864
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by redlumf View Post
Ok, go to your sounds directory.
Do this:
Code:
for f in *.mp3 ; do sox -v `sox "$f" -n stat -v 2>&1` "$f" `basename "$f" .mp3`.ogg; done
(btw, needs sox...install it if you don't have it)
If the above worked (ignore the warnings), you now have all your mp3 converted to ogg. (Also volume normalised cause I find the originals way to low on the volume side

Now, lets fix the sound.cfg
Code:
sed -i -- 's/.mp3/.ogg/g' sound.cfg
Done.

Enjoy your sounds in .ogg now.
I guess I should have seen that coming

Let me put it in a different way.

The current Angband sounds are Dubtrain's sounds, converted to mp3 (because wavs were too large - 3M vs 35M). These play fine in the Windows and OS X ports, but only in some Linux distros, with the problem being scarcity of open source mp3-playing software.

Is anyone aware of a cross-platform way to solve all this, or do we just assume that Linux folk can sort it out for themselves as in this thread?
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.

Last edited by Nick; March 19, 2016 at 22:29. Reason: Double counting
Nick is offline   Reply With Quote
Old March 19, 2016, 22:34   #10
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by calris View Post
I've pulled out the parsing of the sound.cfg file and added callbacks into the sound module for loading of the actual sample files. Should make additional sound modules even easier to add
This is excellent news. It's been needing doing for years and I'm glad you got there first
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound? Quinn13 Vanilla 4 March 3, 2013 10:08
linux sound? runequester Vanilla 8 April 22, 2012 23:42
Probably going to sound stupid Monkay Vanilla 6 March 20, 2012 14:16
Sound Not working at all froboz Vanilla 1 June 22, 2010 19:12
Sound on Linux with X11 is it available. tuppe666 Vanilla 10 September 13, 2007 17:42


All times are GMT +1. The time now is 20:34.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.