[Linux] Bsnes and OSS4

Archived bsnes development news, feature requests and bug reports. Forum is now located at http://board.byuu.org/
Locked
ZH/Franky

[Linux] Bsnes and OSS4

Post by ZH/Franky »

I've always been pissed off that bsnes works beautifully for me in windows, but runs like shit on linux.
Part of this might be the crappy support for ATI cards in Linux (I have an ATI card), but there's another problem... ALSA.

I've recently installed ubuntu on my machine. I've been meaning to try out OSS4, instead of just using ALSA, because I've heard that it's so much better. What I heard was correct.

Beforehand, when running with ALSA, in bsnes I'd set system.video to xv (I'm using the open source drivers) and system.audio to openal.
The sound would be fine, and I would get 60fps, but it always looked like it was skipping frames (even with frameskip set to 0).

So, with ALSA removed from my system, and with OSS4 configured instead, I set system.video (in bsnes) to xv, and system.audio to oss. I play any game on bsnes linux now and it's perfect. Like before, I get 60fps, but the video is now nice and smooth. It must just be that ALSA produces a lot more overhead, and that OSS4 is faster (well, obviously, since I now not only get better performance on bsnes, but on my entire system)

The only problem I have now is that I occasionally get some static sound when playing games.
Sound is fine for everything else now, but in bsnes sound crackles. This might have something to do with bsnes running just a little but under fullspeed (like 1 fps below what it should do at times), but I'm not sure (and please don't crucify me if I'm wrong).
It's ok though; most of the time the crackling is barely audible; it only really shows itself when bsnes drops a few frames, which is every 3 or 4 minutes or so. EDIT: The first game I tested was Chrono Trigger where I got minor crackling sounds and occasional big crackling sounds; I tested a bunch of other games and I rarely get any sound crackling. I'm guessing this sound crackling has something to do with OSS4 trying to sync with the video and when the video lags even a little bit, so does OSS4, and then from this lag, sound in OSS4 crackles.
That settles it; OSS4 is awesome.

Another minor problem is that setting speed to uncapped now does nothing, it still runs at 60 fps (not like people would want to not play at the correct speed anyway).

OSS4 not only solves all the problems I have with bsnes on linux, but it also solves a lot of other problems; with other emulators I can now use OSS and get better sound. In general, the sound on my system is just better. Runescape works perfectly now too :) (with ALSA+PulseAudio, video and audio were out of sync).

Basically, ALSA+PulseAudio is shitty (I'm using Ubuntu 8.04.1). OSS4+esd is the way to go.

Well, if any of you guys here runs Ubuntu Linux, here is the guide I referred to:
https://help.ubuntu.com/community/OpenSound

Anyway, I hear byuu say that a lot of people complain about sound, and performance in the linux version of bsnes. This might help reduce some of the problems people have.
(I hope it does anyway; it does for me, at least).

EDIT:
While OSS4 is better, I've found that in the linux version of nestopia, OSS makes it slow (for now, I assume that this has to do witht he OSS driver in nestopia being badly written, and not the actual OSS4 being slow).
I installed an OSS plugin for sdl, and set the audio driver in nestopia to sdl, and it was perfect again.
To install this oss plugin for alsa (I'm assuming you use ubuntu), just do:

Code: Select all

sudo apt-get install libsdl1.2debian-oss
then set the audio driver in nestopia to sdl:
Image
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

It really depends on your sound hardware.Some cards perform better with OSS and some are better with ALSA.
For integrated (onboard) audio,X-Fi based cards and a small number of pro audio interfaces,I'd recommend OSS4.
For Creative cards(Live,Audigy,Audigy2/4),CMI/Oxygen-based (ASUS,Auzentech,...) and everything else ALSA is a much better option.

With OSS4,your SoundMax may sound *great*,but your Audigy2 will sound like shit :)

Some other things to know about ALSA:
ALSA+PulseAudio = FAIL
If you use ALSA together with PulseAudio,then yes - it sucks.Get rid of that PulseAudio junk ASAP.It only adds massive overhead and latency to your audio.
[i]Have a nice kick in da nutz[/i] @~@* c//
ZH/Franky

Post by ZH/Franky »

Well kick, if what you say is correct, then I have made a good choice to use OSS4+esd.
(I have onboard sound; Intel HDA 82801G (revision 1))
Get rid of that PulseAudio junk ASAP.It only adds massive overhead and latency to your audio.
Before going with OSS4 and esd, I tried to remove pulseaudio, but that also removed ALSA (or was that ubuntu-desktop? I don't exactly remember (ubuntu-desktop is a container for lots of packages, namely the gnome de, and a few other things)), but I remember it trying to remove something I wanted to keep anyway (I'm using Ubuntu). If I wanted to use ALSA without Pulseaudio on my system, I'd have to not use the version of ALSA in the ubuntu repos, and instead compile my own copy and configure it myself (mind you, that's what I did when installing OSS4 and esd anyway, so I'm sure it wouldn't prove too difficult for me).
(I'm much happier with OSS4 anyway, so like hell I'll install ALSA (be it through repos or manually) anyway.

Man, why don't I just go back to using ArchLinux... at least Arch doesn't force things upon you, and actually doesn't do *anything* automatically, at all (it's the most non-user-friendly distro out there, basically; but it lets you configure your system to every last detail, in the exact way you want) (then again, by removing some shit and doing some major tweaking and hacking, I could probably get my ubuntu installation to the same state as I had my previous Arch installation in).
henke37
Lurker
Posts: 152
Joined: Tue Apr 10, 2007 4:30 pm
Location: Sweden
Contact:

Post by henke37 »

What is needed in packet dependencies is the bridge design pattern. Too bad it isn't done atm.
F-3582
Rookie
Posts: 40
Joined: Fri Jan 21, 2005 5:17 pm

Post by F-3582 »

Franky wrote:Before going with OSS4 and esd, I tried to remove pulseaudio, but that also removed ALSA (or was that ubuntu-desktop? I don't exactly remember (ubuntu-desktop is a container for lots of packages, namely the gnome de, and a few other things)), but I remember it trying to remove something I wanted to keep anyway (I'm using Ubuntu).
Did you follow this guide? Ubuntu-Desktop is expected to be removed, since Pulseaudio is a dependency. No big deal, though, unless you are planning to upgrade Ubuntu to the next major release.

Anyway, interestingly different emulators seem to work well with different sound systems. ZSNES, for example, sounds best with OSS while anything else lags a lot, while Mednafen has has almost zero latency when using ALSA and anything else (including OSS or CoreAudio) gives me some noticeable latency. I'm using ALSA+Pulseaudio on Fedora 9 with an on-board ICH4 card, by the way.

Before continuing to bash Pulseaudio, one should give the next version a try - which is currently only in Rawhide - which I'm reluctant to use ;) Lennart promised some significant performance boost with greatly reduced overhead and latency. Let's see how that turns out.
Dullaron
Lurker
Posts: 199
Joined: Mon Mar 10, 2008 11:36 pm

Post by Dullaron »

I download the Ubuntu the other day.

I got it to install from using the Alcohol 120% clone drive because it faster way to do it.

Cd reading was too slow after reboot computer. I didn't want to wait that long. :roll:
Window Vista Home Premium 32-bit / Intel Core 2 Quad Q6600 2.40Ghz / 3.00 GB RAM / Nvidia GeForce 8500 GT
ZH/Franky

Post by ZH/Franky »

F-3582 wrote:
Franky wrote:Before going with OSS4 and esd, I tried to remove pulseaudio, but that also removed ALSA (or was that ubuntu-desktop? I don't exactly remember (ubuntu-desktop is a container for lots of packages, namely the gnome de, and a few other things)), but I remember it trying to remove something I wanted to keep anyway (I'm using Ubuntu).
Did you follow this guide? Ubuntu-Desktop is expected to be removed, since Pulseaudio is a dependency. No big deal, though, unless you are planning to upgrade Ubuntu to the next major release.
Yeah, I followed that guide (in fact, I gave a link to that exact guide in my original post).
I suppose it wouldn't matter if ubuntu-desktop was removed when i remove pulseaudio; I can just install gnome, alsa, etc manually.

Anyway, I've always had problems with ALSA on any distro I've used (I have an integrated sound chip; Intel HDA, 82801G (revision 1); it's an ICH7 card). When I installed OSS4 and esd, all of the problems I had went away. My system is just so much better now. I'm not at all bothered about having problems upgrading to the next release of ubuntu; I can revert back to ALSA and PulseAudio easily; I haven't removed them -- I've just blacklisted them (that way, I can keep ubuntu-desktop). All I need to do if I want to upgrade to a newer version of ubuntu is delete OSS4 and esd, then re-enable ALSA and PulseAudio.
Ubuntu 8.04 (the version I'm using) is LTS (long term support) anyway, so it'll be years until updates for it stop (so I have a long time before needing to upgrade to the next version).
Anyway, interestingly different emulators seem to work well with different sound systems. ZSNES, for example, sounds best with OSS while anything else lags a lot, while Mednafen has has almost zero latency when using ALSA and anything else (including OSS or CoreAudio) gives me some noticeable latency. I'm using ALSA+Pulseaudio on Fedora 9 with an on-board ICH4 card, by the way.
Yeah, nestopia ran like shit when I installed OSS4; setting nestopia sound to OSS made it run really slow, so I went with sdl after installing an OSS plug for sdl.
Snes9x also outputted no sound; I checked it in my terminal and it was because it was after ALSA libraries. I knew that snes9x worked well with OSS4, so something else was at play; I realized that the version of portaudio I had (from ubuntu repos) was compiled to be used with ALSA; so I removed the version of portaudio I had, downloaded the source code from portaudio's official site, and compiled it myself, telling it to ignore ALSA, instead telling it to use OSS4 (I don't exactly remember, but I think I gave the configure script a --no-alsa switch or something before running the Makefile script). After I did that, sound in Snes9x was perfect.
EDIT:
Just installed zsnes today. Sound didn't work at all (with either ALSA or OSS). Though I have OSS4, I gave zsnes an "-ad oss" switch and sound didn't work. Remember that I have that oss pluging for sdl, along with sdl itself... I gave zsnes a -ad sdl switch and sound is perfect.

Well, OSS4 is good but it does create problems with some programs on my system. Ohwell, the positives outweigh the negatives I suppose.
Before continuing to bash Pulseaudio, one should give the next version a try - which is currently only in Rawhide - which I'm reluctant to use Wink Lennart promised some significant performance boost with greatly reduced overhead and latency. Let's see how that turns out.
Well, I'm not saying that pulse isn't a good idea. I'm jsut saying that right now, it's a mess.
The problem is that pulseaudio is just so new, and hasn't been given enough time to mature yet. In time, it will be good. Even so, if pulseaudio becomes much better than esd, I will still use OSS4 (and if need be, replace esd with pulse, using pulse with OSS4 if possible). Anyway, I doubt I'll ever do that, because OSS4+esd works like a charm, and I expect those both to continue improving themselves, so chances are, OSS4 and esd will be my preferred choice for a long time.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Franky wrote: Just installed zsnes today. Sound didn't work at all (with either ALSA or OSS). Though I have OSS4, I gave zsnes an "-ad oss" switch and sound didn't work. Remember that I have that oss pluging for sdl, along with sdl itself... I gave zsnes a -ad sdl switch and sound is perfect.
Use ZSNES v1.51b
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Locked