Distorted sound with i82801DB-ICH4 controller & ALC250 c

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Distorted sound with i82801DB-ICH4 controller & ALC250 c

Post by hakonrk »

I have a laptop with an Intel 82801DB-ICH4 sound controller and an
ALC250 codec. It works perfectly with other Linux applications I
have tested, but in ZSNES (tried both 1.36 and 1.42), the sound
is badly distorted (I can make some samples if you'd like to
hear it). I also tried running the Windows version of ZSNES,
and there is absolutely no distortion there.

Here's some additional system information:

CPU: Pentium-M 1.6 GHz
RAM: 512 MB
Distro: Fedora Core 4
GCC: 4.0.0-8 (also tried 3.3.4)
Nasm: 0.98.39-3
glibc: 2.3.5-10
SDL: 1.2.8-3.2
kernel: 2.6.11-1.1369_FC4
alsa-utils/lib: 1.0.9rc2-2

Has anyone else observed this? Can anyone think of any reason for why
the sound would be distorted under Linux, but not Windows?
Thanks in advance for any help.
Joe Camacho
Devil's Advocate
Posts: 2293
Joined: Mon Aug 02, 2004 7:51 pm
Location: Hmo. Son.

Post by Joe Camacho »

I know close to nothing about Linux, but I have seen various topics on the Linux Ver. of zsnes referring to sound issues. Have you tried a search? :?
*Sometimes I edit my posts just to correct mistakes.
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Joe Camacho wrote:I know close to nothing about Linux, but I have seen various topics on the Linux Ver. of zsnes referring to sound issues. Have you tried a search? :?
Yes, I have searched, and I think I have skimmed through most of the
other bug reports, but I couldn't find anything that seems to be related.

By the way, I have also tried various different sound configurations
(sample rate, filtering, etc.), but no success. Also, I should probably
state explicitly that this bug is not related to a particular game.
Everything I have tried so far exhibits the same garbled sound.
Joe Camacho
Devil's Advocate
Posts: 2293
Joined: Mon Aug 02, 2004 7:51 pm
Location: Hmo. Son.

Post by Joe Camacho »

Have to tried with games other than Squaresoft games? there is a known issue with squaresoft games and sound.
*Sometimes I edit my posts just to correct mistakes.
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Joe Camacho wrote:Have to tried with games other than Squaresoft games? there is a known issue with squaresoft games and sound.
I haven't tried a single Squaresoft game, so yes: This problem is general.
Anyway, thanks for your suggestions so far!
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I know this may or may not apply to you, but I use FreeBSD and I found the only way I can use sound in ZSNES without it being messed up or causing ZSNES to not freeze is to use either Gaussian or Cubic Spline sound interpolation and no low-pass filter. I'm sure running the *nix version under Linux is different and probably has less of the problems that the *nix version has under FreeBSD, but it can't hurt to try. I too am using an ICH based sound controller (the nForce2 chipset aparently uses ICH based sound components).
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

CyberBotX wrote:I know this may or may not apply to you, but I use FreeBSD and I found the only way I can use sound in ZSNES without it being messed up or causing ZSNES to not freeze is to use either Gaussian or Cubic Spline sound interpolation and no low-pass filter.[...].
Thanks, but this didn't solve my problem. :-/ I'll make some samples
that show exactly what my problem sounds like - that'll hopefully make
the bug hunt somewhat easier.
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

This is what the intro to Super Star Wars sounds like on Windows:

http://folk.uio.no/hakonrk/tmp/ssw-windows.mp3

This is what it sounds like on Linux:

http://folk.uio.no/hakonrk/tmp/ssw-linux.mp3

Clearly, you don't have to be an audiophile to tell the difference. :-)
AWJ
Rookie
Posts: 17
Joined: Sat Aug 14, 2004 4:36 am

Post by AWJ »

Try this:

export SDL_AUDIODRIVER=dsp

Type this at a terminal and then run zsnes from that terminal (not from the GUI). If it fixes the problem, then add the line to your .bash_profile, log out and log back in and it'll be set "permanently".

I'm not sure why this is necessary--/dev/dsp should be SDL's default choice of audio output. Perhaps Fedora's build of SDL has something funny done to its defaults.

Here's a related problem I have. I'm running FC3 on a machine with onboard sound (VIA 8237 controller + ALC850 codec), and to get non-distorted sound out of ZSNES I had to use both SDL_AUDIODRIVER=dsp and SDL_DSP_NOSELECT=1. However, the results still weren't perfectly satisfactory--after a while, the sound would start to make popping noises. The higher the sample rate, the sooner the popping kicked in and the worse it was. Knowing that the OSS support had been overhauled in SDL 1.2.8, I tried upgrading my SDL from 1.2.7 to 1.2.8 using the RPM from FC4 (probably not an officially-supported upgrade method, heh) After doing this I no longer needed the SDL_DSP_NOSELECT environment variable, and the sound no longer started popping. However, now I can't use 48000 Hz at all--it skips like a broken record. Everything up to 44100 Hz works beautifully. I don't exactly mind (I can't hear much difference between 44100 and 48000) but I'd be interested in knowing why.
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

AWJ wrote:Try this:

export SDL_AUDIODRIVER=dsp

Type this at a terminal and then run zsnes from that terminal (not from the GUI). If it fixes the problem, then add the line to your .bash_profile, log out and log back in and it'll be set "permanently".

I'm not sure why this is necessary--/dev/dsp should be SDL's default choice of audio output. Perhaps Fedora's build of SDL has something funny done to its defaults.

Here's a related problem I have. I'm running FC3 on a machine with onboard sound (VIA 8237 controller + ALC850 codec), and to get non-distorted sound out of ZSNES I had to use both SDL_AUDIODRIVER=dsp and SDL_DSP_NOSELECT=1. However, the results still weren't perfectly satisfactory--after a while, the sound would start to make popping noises. The higher the sample rate, the sooner the popping kicked in and the worse it was. Knowing that the OSS support had been overhauled in SDL 1.2.8, I tried upgrading my SDL from 1.2.7 to 1.2.8 using the RPM from FC4 (probably not an officially-supported upgrade method, heh) After doing this I no longer needed the SDL_DSP_NOSELECT environment variable, and the sound no longer started popping. However, now I can't use 48000 Hz at all--it skips like a broken record. Everything up to 44100 Hz works beautifully. I don't exactly mind (I can't hear much difference between 44100 and 48000) but I'd be interested in knowing why.
Thanks! Setting SDL_AUDIODRIVER=dsp reduced the amount of distortion significantly. The popping background noise is gone, but it's still not perfect: I can still hear certain sounds looping (most easily noticed in Super Star Wars' percussion effects). Changing the playback sample rate didn't make any difference for me; 44.1 kHz sounds about the same as 48 kHz. I also tried 22.05 kHz, but still I can hear looping samples.

Anyway, doesn't SDL_AUDIODRIVER=dsp mean that SDL is instructed to use the old OSS API instead of ALSA? If so, it would seem that at least part of the problem is the way SDL (or ZSNES) uses the ALSA API. Strange that it only affects the ALC850 codec.
AWJ
Rookie
Posts: 17
Joined: Sat Aug 14, 2004 4:36 am

Post by AWJ »

hakonrk wrote:Thanks! Setting SDL_AUDIODRIVER=dsp reduced the amount of distortion significantly. The popping background noise is gone, but it's still not perfect: I can still hear certain sounds looping (most easily noticed in Super Star Wars' percussion effects). Changing the playback sample rate didn't make any difference for me; 44.1 kHz sounds about the same as 48 kHz. I also tried 22.05 kHz, but still I can hear looping samples.
Did you try setting SDL_DSP_NOSELECT=1? I don't know if it still does anything in SDL 1.2.8, but it's worth a try.
hakonrk wrote:Anyway, doesn't SDL_AUDIODRIVER=dsp mean that SDL is instructed to use the old OSS API instead of ALSA? If so, it would seem that at least part of the problem is the way SDL (or ZSNES) uses the ALSA API. Strange that it only affects the ALC850 codec.
I don't think ALSA is what Fedora's SDL is using by default. The reason is if I export SDL_AUDIODRIVER=alsa and then run ZSNES, I get an error message to stderr and no sound at all. I suspect what SDL might be defaulting to is ESD, GNOME's software mixer, which is rather unsuitable for games and very very unsuitable for emulators (latency...).

I don't know if the difference between our results is due to different hardware (Intel vs. VIA controller) or different software (I mentioned that I'm running FC3, which has a different kernel, different version of ALSA and probably all sorts of different configuration settings from FC4)
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

AWJ wrote:Did you try setting SDL_DSP_NOSELECT=1? I don't know if it still does anything in SDL 1.2.8, but it's worth a try.
I tried it, and it doesn't seem to make any difference.
AWJ wrote:I don't think ALSA is what Fedora's SDL is using by default. The reason is if I export SDL_AUDIODRIVER=alsa and then run ZSNES, I get an error message to stderr and no sound at all.
I sometimes get the following error message when I don't specify an SDL audio driver:
ALSA lib pcm_dmix.c:807:(snd_pcm_dmix_open) unable to open slave
So it would seem that in FC4, SDL is configured to use ALSA by default. (Btw, there's sound even when the above error appears.)
AWJ wrote:I suspect what SDL might be defaulting to is ESD, GNOME's software mixer, which is rather unsuitable for games and very very unsuitable for emulators (latency...).
esd is not running on my system, but the ALSA error message I mentioned above includes "dmix". Does that mean it uses the Dmix ALSA plugin? (http://alsa.opensrc.org/index.php?page=DmixPlugin) Perhaps that could explain things? My other PC has a SB Live card which does hardware mixing, so only my laptop would need dmix.
Post Reply