Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 121636

Summary: alsa sound in apps that use libsdl has background static
Product: Gentoo Linux Reporter: Andreas Eriksson <andreas>
Component: [OLD] GamesAssignee: Gentoo Games <games>
Status: RESOLVED UPSTREAM    
Severity: normal CC: alsa-bugs, s.geschwandtner, stian
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Andreas Eriksson 2006-02-05 01:18:36 UTC
I noticed that zsnes had some weird sound problem, the sound was slightly distorted, like it was mixed together with some background static from a radio. After investigating some I found that recompiling libsdl with USE="oss" fixes it. So apperantly it can't handle alsa too good. I think this happens in other apps that use sdl for sound too.

The temporary fix is to remove the oss useflag and always compile libsdl as if the oss useflag was set, but the bug with alsa should be fixed.
Comment 1 Andreas Eriksson 2006-02-05 01:19:11 UTC
and it seems like I'm not the only one with this problem:
http://forums.gentoo.org/viewtopic-t-409075-highlight-zsnes.html
Comment 2 corvvin 2006-09-13 05:42:24 UTC
(In reply to comment #0)
You don't need to recompile libsdl, it uses SDL_AUDIODRIVER variable and as
temporary solution you can set desired driver there (I recommend esd).
Please see http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars.
But alsa output indeed should be fixes, I have this problem too.
Comment 3 Tupone Alfredo gentoo-dev 2006-09-13 16:20:09 UTC
I remember that lately, a change in alsa had fixed some sound problem.
Would you mind updating your system (kernel and alsa-*) and then retesting it?
Comment 4 Sascha G. 2006-09-13 17:17:49 UTC
(In reply to comment #3)
> I remember that lately, a change in alsa had fixed some sound problem.
> Would you mind updating your system (kernel and alsa-*) and then retesting it?

Doesn't help over here (ALSA version 1.0.12, using alsa-driver).

Portage 2.1.1 (selinux/2005.1/x86/hardened, gcc-3.4.6, glibc-2.3.6-r4, 2.6.17-hardened-r1 i686)
=================================================================
System uname: 2.6.17-hardened-r1 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz
Gentoo Base System version 1.12.4
Last Sync: Wed, 13 Sep 2006 14:50:01 +0000
app-admin/eselect-compiler: [Not Present]
dev-lang/python:     2.4.3-r3
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.60
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical"
FEATURES="autoconfig collision-protect distlocks loadpolicy parallel-fetch sandbox selinux sfperms strict stricter userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from /etc/portage/rsync_excludes"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X a52 aac alsa bzip2 caps cjk crypt cups dts dvd dvdread elibc_glibc ffmpeg flac ftp gif gtk hardened idn input_devices_keyboard input_devices_mouse ipv6 jpeg kdeenablefinal kernel_linux linguas_en mad mikmod mmx mp3 ncurses nptl offensive ogg opengl pam pdf pic png selinux sse sse2 ssl symlink theora threads tiff truetype unicode userland_GNU video_cards_nvidia vorbis win32codecs xinerama xv xvid zlib"
Unset:  CTARGET, INSTALL_MASK, LC_ALL
Comment 5 Mr. Bones. (RETIRED) gentoo-dev 2006-09-18 12:36:22 UTC
still an issue with alsa-lib-1.0.12
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-10-04 23:58:35 UTC
I don't have an x86 system to check this, but are we sure the problem is in ALSA rather than libsdl?

By the way, 1.0.13 is out for a while now.
Comment 7 Sascha G. 2006-10-05 01:04:01 UTC
(In reply to comment #6)
> I don't have an x86 system to check this, but are we sure the problem is in
> ALSA rather than libsdl?

To me, this looks more like a problem in libsdl, as it *only* happens in programs (games) that play sound via SDL, which, in turn, uses ALSA.

> By the way, 1.0.13 is out for a while now.

Doesn't change anything for me.
Comment 8 Sascha G. 2007-01-22 03:18:40 UTC
games-strategy/wesnoth used to have this problem. In version 1.2.1, the following change was made (from the changelog):

* set default sample rate to 44100 hz as most user got cracking sound pb
  with 22050

The static is gone now. If I set the sample rate back to 22050Hz (it is configurable now), it reappears.
Comment 9 Stian Skjelstad 2007-07-19 20:56:01 UTC
I see the same problem with zsnes: If I set the mixing rate to 22050 or 44100 it sounds very bad, but if I use 48000 (which is the only mixing rate that driver/card supports), everything is fine. I'll see if I get the time to investigate further tomorrow
Comment 10 SpanKY gentoo-dev 2008-02-27 21:01:14 UTC
sounds like a resampling bug in alsa, not libsdl

use the frequency your card uses rather than forcing downsampling