Getting sound to work in Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • calris
    Adept
    • Mar 2016
    • 194

    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
  • AnonymousHero
    Veteran
    • Jun 2007
    • 1393

    #2
    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.

    Comment

    • calris
      Adept
      • Mar 2016
      • 194

      #3
      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?

      Comment

      • Nick
        Vanilla maintainer
        • Apr 2007
        • 9647

        #4
        Originally posted by calris
        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.

        Comment

        • redlumf
          Scout
          • Aug 2015
          • 25

          #5
          Originally posted by calris
          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.

          Comment

          • redlumf
            Scout
            • Aug 2015
            • 25

            #6
            Originally posted by Nick
            ...
            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.

            Comment

            • calris
              Adept
              • Mar 2016
              • 194

              #7
              Originally posted by redlumf
              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

              Comment

              • calris
                Adept
                • Mar 2016
                • 194

                #8
                Originally posted by redlumf
                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

                Comment

                • Nick
                  Vanilla maintainer
                  • Apr 2007
                  • 9647

                  #9
                  Originally posted by redlumf
                  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?
                  Last edited by Nick; March 19, 2016, 22:29. Reason: Double counting
                  One for the Dark Lord on his dark throne
                  In the Land of Mordor where the Shadows lie.

                  Comment

                  • takkaria
                    Veteran
                    • Apr 2007
                    • 1951

                    #10
                    Originally posted by calris
                    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-

                    Comment

                    • Derakon
                      Prophet
                      • Dec 2009
                      • 9022

                      #11
                      Is there any particular reason to use mp3 over ogg vorbis?

                      Comment

                      • HermannD
                        Rookie
                        • Jan 2014
                        • 13

                        #12
                        Originally posted by Derakon
                        Is there any particular reason to use mp3 over ogg vorbis?
                        Given how Nick described it, I would guess no easy support on Windows and Mac? If so, when was that last checked? Maybe that situation (or whatever the actual reason is) has changed.
                        ? of *Destruction* makes the better maps.

                        Comment

                        • redlumf
                          Scout
                          • Aug 2015
                          • 25

                          #13
                          Originally posted by Nick
                          are 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?
                          Isn't ogg a cross-platform solution? (You should have seen this one coming also :P)

                          Comment

                          • takkaria
                            Veteran
                            • Apr 2007
                            • 1951

                            #14
                            Originally posted by redlumf
                            Isn't ogg a cross-platform solution? (You should have seen this one coming also :P)
                            MP3 is the most universal lossy format. You can play it without using an external library or with any extra downloads using Windows and OS X. That isn't the case for any of the Ogg codecs AFAICT.
                            takkaria whispers something about options. -more-

                            Comment

                            • molybdenum
                              Apprentice
                              • May 2013
                              • 84

                              #15
                              Originally posted by takkaria
                              MP3 is the most universal lossy format. You can play it without using an external library or with any extra downloads using Windows and OS X. That isn't the case for any of the Ogg codecs AFAICT.
                              OS X does not support Ogg containers nor any containers that can contain Vorbis audio. These are the native supported containers and data formats. There's not really much in that list that would be cross-platform, compressed, and provide good audio quality.

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎