Linux sound problems fixed!

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
noisyb

Linux sound problems fixed!

Post by noisyb »

I have found a way to fix the broken sound in Linux.

ALSA doesn't work. No Sound.
OSS doesn't work. No Sound
SDL doesn't work. Broken Sound.

There is a Linux program called wine http://winehq.org/ , when I download the zipped ZSnes and start it this way:

wine zsnes.exe

The Linux sound works perfectly. I don't know what wine does but would it be possible to include it in the next ZSnes release? It's GPL too, I think.

Keep up the good work! :D
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Providing wine as a solution is not happening.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Haha, talk about a lousy way to fix linux.

Also, if you're trying to run the Win port in linux, don't expect sound... or anything, for that matter - without Wine, I mean.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
LiquidAcid
Rookie
Posts: 20
Joined: Thu Mar 01, 2007 6:47 pm

Post by LiquidAcid »

Wine is pretty good in mapping waveout and dsound to ALSA.

Sad to see that the zsnes team doesn't succeed in interfacing correctly with ALSA...
Kajuru
Regular
Posts: 253
Joined: Wed Oct 18, 2006 6:43 pm
Location: localhost

Post by Kajuru »

Every Win app with a Lin port should drop said Linux port, since Wine "fixes" them. Way to go...NO!
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

LiquidAcid wrote:Sad to see that the zsnes team doesn't succeed in interfacing correctly with ALSA...
Refer to this when speaking of ALSA: http://insanecoding.blogspot.com/2007/0 ... linux.html
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
LiquidAcid
Rookie
Posts: 20
Joined: Thu Mar 01, 2007 6:47 pm

Post by LiquidAcid »

FUD
byuu

Post by byuu »

LiquidAcid wrote:FUD
I'm sorry, and what are your qualifications for claiming this about Nach's article, again?

Rather than a short acronym, please point out some factual evidence of "FUD" in anything within Nach's article.

WINE is a major project that's been under development by hundreds of people, and has been around longer than ZSNES. Why you think the ZSNES devs should be as capable of manipulating ALSA as them, I don't know.

And really, with as many talented people on ZSNES as there are, the fact that even they can't get ALSA to sound good should really, really tell you something about ALSA.
LiquidAcid
Rookie
Posts: 20
Joined: Thu Mar 01, 2007 6:47 pm

Post by LiquidAcid »

The ALSA sound driver implementation of wine is quite young compared to the age of the whole project byuu.

If ALSA sucks really so hard how everyone claims here wine should have an insane amount of problems with the audio. But it hasn't, not on my desktop system with a dedicated soundcard, nor on my laptop system with a integrated chip.
In fact I have currently more trouble with input devices in wine, and sound was never a problem for me after the ALSA driver was integrated.

I'm just pointing out that devs here are not willing to support ALSA, just because it's linux only. On the other hand dsound support is implemented, which is also only for one operating system type.

And everytime a discussion about audio on linux comes up this link is posted. Has anyone even though about that the situation has already changed? That's like: "ALSA sucked some time ago, it's destined to suck for all time coming"

And just to prevent this question. Yes, I have read the text from nach's blog. And I disagree.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

ALSA sucks at variable amounts of samples per frame and low latency.
Which makes it suck for ZSNES among other stuff.

Pre-blargg core was bufferable enough not to crap out with ALSA on some setups, yet a lot of linux users reported sound issues. Obviously zsnes is at fault. From what I read, most of these users got a better result using the preliminary OSS code added post 1.51. Obviously zsnes is at fault.

You'll compare how wine fares with a win port of zsnes that actually uses the new sound core.

Discussion over.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
byuu

Post by byuu »

If ALSA sucks really so hard how everyone claims here wine should have an insane amount of problems with the audio. But it hasn't, not on my desktop system with a dedicated soundcard, nor on my laptop system with a integrated chip.
An emulator has a lot of demands that most applications do not. Audacious, mplayer et al have no difficulty with playing back audio. It's all they do.

Now, given, you said ZSNES+Wine works well. That's impressive. Perhaps their dev team of 100 wouldn't mind helping out us emu authors with sound drivers for our emulators :)
I'm just pointing out that devs here are not willing to support ALSA, just because it's linux only. On the other hand dsound support is implemented, which is also only for one operating system type.
DirectSound is used by ~97% of the ZSNES userbase. ALSA is used by ~2%. You pretty much have to support the former -- but the latter, not so much. ALSA goes against the spirit of Unix and interoperability, whereas OSS does not. Microsoft has always been a vendor lock-in company.

It's not that anyone hates Linux. It's that we don't have time to support every last little esoteric OS with an API straight from the ninth circle of hell. DirectSound, on the other hand, is ridiculously easy to use. Very straightforward, very well documented, and there's fifty times as many users and troubleshooting threads around the internet to research problems from.
And just to prevent this question. Yes, I have read the text from nach's blog. And I disagree.
With which lines? Can you cite sources backing up why you disagree, and why you are right and he is wrong? Just saying you disagree or that Nach is spreading FUD doesn't really tell us anything. If he's wrong, and you can prove it, then I'll give you that :)
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

LiquidAcid wrote: And everytime a discussion about audio on linux comes up this link is posted. Has anyone even though about that the situation has already changed? That's like: "ALSA sucked some time ago, it's destined to suck for all time coming"
You make it sound like that article was written years ago.

But even though it was written a short while ago, stuff has in fact changed! OSS is even better now, ALSA still sucks, and distros seem to be oblivious, probably time for another article. But in my recent tests, all the bad points about ALSA still stands.

And of course all the replies that just keep piling up to the article (in the comments section) about new Linux users having OSS 4 work better for them than ALSA, it should be quite apparent what the story is.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

Reading the article:
But the big embarrassment here for ALSA is that using ALSA via its OSS emulation is usually better than using ALSA directly. I've heard from many users of SDL or libao powered programs that telling those wrappers to use OSS (which ends up being used via ALSA's OSS emulation) works better with less gaps (or other problems) in the audio than using ALSA directly by those wrappers.
I have one of these cases. A GuitaHero-like game called GuitarFun that uses SDL and works a *lot* better using the user-space OSS emulation (so I even still have software mixing) than ALSA directly. But this just happens in my snd-hda-intel (integrated AS1988) driver, on an emu10k1 (Sound Blaster Live!) the game works correctly using ALSA directly.
So this case is clearly a driver bug, not a problem from ALSA itself. But it's a problem that I was only able to reproduce with this game... I found it just two days ago, but now the bug is reported and assigned to an ALSA dev.

So, please, if someone finds that ALSA OSS emulation works better than ALSA directly report it to the ALSA devs... and use OSS4 if you want, but also report it!!!
About workarounds... with GuitarFun I found pretty different behaviour:
- Changing from ALSA, OSS user-space emulation and OSS kernel emulation.
- When using ALSA changing from the "default" device to the "hw" or "plughw" device (so no software mixing).
LiquidAcid
Rookie
Posts: 20
Joined: Thu Mar 01, 2007 6:47 pm

Post by LiquidAcid »

grinvader wrote:You'll compare how wine fares with a win port of zsnes that actually uses the new sound core.
Uhm, I didn't do any comparison of that kind. The only one mentioning wine in combination with a win32 zsnes version was the thread starter.
LiquidAcid
Rookie
Posts: 20
Joined: Thu Mar 01, 2007 6:47 pm

Post by LiquidAcid »

byuu wrote: An emulator has a lot of demands that most applications do not.
wine is facing similar problems like zsnes when translating dsound to alsa.
byuu wrote:You pretty much have to support the former -- but the latter, not so much. ALSA goes against the spirit of Unix and interoperability, whereas OSS does not. Microsoft has always been a vendor lock-in company.
OSS goes against the spirit of free software. I already waiting for the day they close down the source again. I'm not going to replace my ALSA setup with some piece of proprietary software just because the zsnes dev team doesn't like the API.

@Nach's article: No hard facts. I don't see any latency comparison between the different sound systems. In fact the use of numbers is kind of non-existant. You can't expect me to believe this is an objective article. Just someones rant on a piece of technology he failed to understand.

Sorry, but without any kind of number facts this text is just another unsubstantial blog entry.
Also it focuses too much on the wrapper APIs on linux, like SDL or libao. These wrappers are not ALSA. If the wrappers suck ALSA can't help it.

You state that alsalib is not lightweight enough and latency is not the best. And you don't want to use the lowlevel API, so why don't you use JACK.
It's famous for low latency, and even supports OSS backends, and Mac OS audio backends.

The whole blog entry is just there to put down the linux audio infrastructure. Good APIs like JACK or portaudio aren't even mentioned.
Such an article has to be balanced, and I'm only seeing negative critique there.

I really appreciate what Nach and the rest of the zsnes dev team has accomplished over the years. I regularly check the SVN history on bountysource to see what changes were made to the source.
But this constant ALSA bashing really gets on my nerve and I'm not going to stay quiet just because everyone else here backups the developer's wrong opinion on alsa.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

LiquidAcid wrote:@Nach's article: No hard facts. I don't see any latency comparison between the different sound systems. In fact the use of numbers is kind of non-existant. You can't expect me to believe this is an objective article. Just someones rant on a piece of technology he failed to understand.
I don't think you can simply just get numbers and expect to get proper analysis. The way to properly look at it is how the implementation goes. Even if you feel that Nach is not giving ALSA a fair shake, it is most likely because he has had the most success working with OSS. ALSA implementations seem to have a greater inconsistancy (something like Win9x sound drivers prior to DX5) and apps that have sensitivity towards latency (such as ZSNES) bold poorly under ALSA. An audio/media player isn't dealing with dynamic generation of audio in most instances. Using OSS emulation under ALSA unfortunately proves OSS to be a better solution.
You state that alsalib is not lightweight enough and latency is not the best. And you don't want to use the lowlevel API, so why don't you use JACK.
It's famous for low latency, and even supports OSS backends, and Mac OS audio backends.

The whole blog entry is just there to put down the linux audio infrastructure. Good APIs like JACK or portaudio aren't even mentioned.
Such an article has to be balanced, and I'm only seeing negative critique there.
I think it should be addressed at the very least.
I really appreciate what Nach and the rest of the zsnes dev team has accomplished over the years. I regularly check the SVN history on bountysource to see what changes were made to the source.
But this constant ALSA bashing really gets on my nerve and I'm not going to stay quiet just because everyone else here backups the developer's wrong opinion on alsa.
It is purely Nach's opinion, but it hasn't been wrong in respect to ZSNES. Against other things, I cannot verify or claim otherwise that it is true or false. If someone were to provide an ALSA patch for ZSNES that works consistantly on all systems, then you might have a point. Show proof or you aren't being objective in regards to Nach's opinion of the matter.

Unfortunately, this argument has been repeated before, and noone has yet to provide a working patch to make ALSA work on all systems.
Last edited by Deathlike2 on Fri Feb 29, 2008 12:33 am, edited 3 times in total.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

LiquidAcid wrote: I really appreciate what Nach and the rest of the zsnes dev team has accomplished over the years. I regularly check the SVN history on bountysource to see what changes were made to the source.
But this constant ALSA bashing really gets on my nerve and I'm not going to stay quiet just because everyone else here backups the developer's wrong opinion on alsa.
Please show me how to use alsa then, because we have tried for years and while it works for some people it does not for others. APIs are not supposed to require special tweaks to work on different hardware, this is the point of an API. Why is it that I can run sound fine in FreeBSD or Windows but in Linux using ALSA it becomes a huge headache? I would like someone to please, step up and write some ALSA code that works you believe it can be done.
Watering ur plants.
byuu

Post by byuu »

But this just happens in my snd-hda-intel (integrated AS1988) driver
Coincidentally, that is the audio chip used in both of my computers. It would be amusing if all of the ALSA issues turned out to be with this one driver.
OSS goes against the spirit of free software. I already waiting for the day they close down the source again. I'm not going to replace my ALSA setup with some piece of proprietary software just because the zsnes dev team doesn't like the API.
What?? OSS4 is GPL'ed. You're complaining about their licensing practices in the past? Linux itself wasn't always GPL'ed, either. The GPL is not revokable, so you can use OSS4 right now, and fifty years from now. You can fork it if you like. There's nothing "proprietary" about OSS4, except the commercial version. Many open source vendors (MySQL for one) do this, so that's hardly something to complain about. At the end of the day, everyone has to eat.

As it stands, OSS is the only hardware-level, cross-platform, cross-OS, open source API for multiple Unix-like operating systems. That's a major advantage over ALSA right there.

As far as your system, I really don't think anyone here cares what you do with it. Keep ALSA. Rig it to use your PC speaker for audio out. Attach small plastic pagodas to your computer case. We really couldn't care less.
@Nach's article: No hard facts ... But this constant ALSA bashing really gets on my nerve and I'm not going to stay quiet just because everyone else here backups the developer's wrong opinion on alsa.
Again, where are your hard facts?

You can get as loud as you want. Nobody here cares. Write an ALSA driver for ZSNES that works well everywhere, or get technical and point out exactly what Nach has said that is wrong. Cite your sources. We aren't going to take your word at face value over his. This is a simple issue of credibility. Nach is far ahead of you in this community.
APIs are not supposed to require special tweaks to work on different hardware, this is the point of an API.
Amen to that. It would be nice if Linux would embrace open, cross-platform, cross-OS standards, too. I would expect that kind of shit from Microsoft, but not Linux. Nothing stopped them from improving OSS3 even when it went closed source, as every other OS that used it did.
powerspike
Regular
Posts: 236
Joined: Mon Nov 21, 2005 3:43 am

Post by powerspike »

I'm sure there's someone out there that could probably code a proper ALSA driver. I wouldn't totally discredit the thing. Have any of you tried talking to people on the ALSA development team to try to get it working properly? Hell maybe they could get their problems worked out with it. If it's somehow unfixable I don't even see the point of using ALSA at all.

Edit: Rofl I did try the windows version of zsnes in wine with alsa output and it does sound perfect. Though the problem is they can't get it working properly on everyones machine. If they could somehow fix it I'm sure they'd have a setting for it.
Last edited by powerspike on Thu Mar 06, 2008 9:16 pm, edited 1 time in total.
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

In my opinion, another major issue with ALSA is it's Linux only. Linux is NOT the only form of Unix out there. I use FreeBSD, which is another form, and it's sound drivers are OSS-compatible (although not OSS according to them). I think it's a good move on the part of the ZSNES developers to focus on using OSS for sound, as it will allow them to continue to make ZSNES work for more than just Windows and Linux. I would hate to see people using FreeBSD be left out. Hell, I'm sure if it works for FreeBSD, it would work for NetBSD as well. Maybe even Mac OS X later on (although only on Intel processors because of the x86 ASM code).
[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.
RedDwarf
Rookie
Posts: 37
Joined: Thu Jan 27, 2005 7:28 pm

Post by RedDwarf »

byuu wrote:
But this just happens in my snd-hda-intel (integrated AS1988) driver
Coincidentally, that is the audio chip used in both of my computers. It would be amusing if all of the ALSA issues turned out to be with this one driver.
Well, ALSA devs have the cases where they can see AS1988 working better with OSS emulation than directly with ALSA. I hope 1.0.17 have the fixes.

Meanwhile you can try with the "hw" device if you need to test ALSA. Not only Guitarfun worked a lot better with it. Also trying http://mednafen.sourceforge.net/ I saw that a call to snd_pcm_hw_params_set_period_size(), that works with the "hw" device, fails with the "default" device (only on AS1988).
NFITC1
Rookie
Posts: 36
Joined: Wed Jun 21, 2006 4:58 pm
Location: 127.0.0.1
Contact:

Post by NFITC1 »

wine <> fix for anything Linux. Alsa doesn't work for me with this so I'm using OSS.
Post Reply