Linux/FreeBSD/Mac OS X etc sound

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

Best audio API

SDL
10
20%
AO
10
20%
OpenAL
14
29%
Semi Portable OSS
6
12%
Non Portable ALSA
5
10%
Non Portable CoreAudio
1
2%
Other
3
6%
 
Total votes: 49

pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Linux/FreeBSD/Mac OS X etc sound

Post by pagefault »

Edit:
Please skip to this post: http://board.zsnes.com/phpBB2/viewtopic ... 862#136862

Note when voting, if you select a non portable API, you will be locking out many users of ZSNES.
----------------------------------------------------------------------

Ok so I have come to the conclusion that SDL will not meet our needs for ZSNES audio so I am going to write my own audio driver for OSS and ALSA. This will allow ZSNES to output it's sound with much increased accuracy and should be very close to the real thing. My question is what does everyone use/prefer when it comes to sound. For sure I will be developing an OSS driver but how many of you prefer ALSA and/or what other audio interfaces would you like to see. Tutorials and/or SDK documentation links would be good too if you suggest something.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

SDL outputs to whatever driver you are using Pagefault. Having an ALSA or OSS driver would be completely unneccessary. Besides certain chipsets do not yet have ALSA drivers and have only Proprietary OSS drivers. Secondly SDL contains OSS, ALSA, AudioIO, and other audio driver support vectors. Moving from a consolidated code to a external code would only make problems for people running Solaris, FreeBSD, etc. because some distros don't use ALSA or OSS at all.

It would be best to leave it be and use the SDL code base for the best interest of compatibility.

Why exactly is SDL not working as it should? What version are you using also?

It's almost like saying DirectSound isn't doing what we want so we are going to use A3D 3.0 as our new audio driver. Now for starters, not all cards and chipsets even support A3D 3.0 which by native was built for Aureal sound cards though a certain few like Creative's Emu10kx and some older SoundBlaster chipsets support it via a wrapper. Nowadays some cards contain no support at all for it and even those who once had Sensaura3D support and an A3D 1.0 wrapper have removed that as well.

It would be best to use what we have till SDL gets updated again (it could be your kernel too as certain 2.4 kernels have really awful SDL audio with ALSA but with 2.6 kernels it's as crisp and clear as DirectSound is on Windows).
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

The problem is that SDL sound is shit in comparison to using ALSA or OSS directly.

And I will be freakin' surprised if there's a soundcard that isn't supported by ALSA or OSS, even the commercial variant of the latter.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

ALSA, hands down.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

How can ALSA have better code when the ALSA core of SDL uses whatever is compiled by your system wether it be OSS, ALSA, or AudioIO? It's a pointless argument IMO because there is no point if you see what you compiled SDL for and with. SDL formulates itself to whatever default audio YOU compile it for and it uses those headers and libraries unless you use the default distribution but most distros use ALSA anyway. My system uses ALSA and I actually rebuilt a CVS download of SDL with ALSA as it's default audio driver and even though I knew it was using ALSA it still sounded pretty good but my SDL always outputed to ALSA.

I'm dead serious when I say it's more or less your kernel especially if you use kernel 2.4.xx as I have experienced this first hand. I even posted on this once saying I was wondering why 2.6.xx made it sound better. Well for starters ALSA is the native core audio of 2.6.xx, 2.6.xx has better handling instructions at the kernel core, and really 2.4.xx is dinoware IMO. Plus, it can also be your sound card/chipset as well. With Linux I say if you want great audio go Creative labs products or someone with good Linux support and quality proprietary drivers. All those ADI, Crystal, C-Media, and other low-end cards and chipsets just do not cut it.

I'm only saying this because many NON-Linux or BSD based distros do NOT use ALSA or OSS natively. Yes 4-Front's OSS Retail version does have many UNIX distros covered but I highly doubt anyone here is going to shell out the cash just to get the compatibility or switch to a Linux w/ ALSA distro just for ZSnes to have audio. I don't even think ANY BSD based distro even begins to support ALSA. AFAIK ALSA is Linux ONLY.

This is no different that asking for OpenAL as the audio rendering driver. If you want an answer on that look for the topic regarding it and find the answer in there. Like it or not SDL is the BEST choice we have to deal with compatibility and cross-platform wise.

And if you still think SDL is crap check this document over and then made an informed and educated re-evaluation before judging. It might not even be SDL.

http://osdl.sourceforge.net/OSDL/OSDL-0 ... audio.html
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I believe I read somewhere that FreeBSD's sound core is based on OSS, although how this can be since OSS is closed-source ie beyond me. I haven't done a lot of sound programming, so I'd say whatever you can do to make ZSNES's sound better for the *nix croud would be the best choice.
[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.
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

Only OSS/commercial is closed-source, otherwise the entirely free implementation available in the kernel wouldn't exist.

Bahamut_ZERO_939 or whatever, shut up. Even commercial games such as UT99 use OSS directly when they use SDL for rendering, and they're paid to deliver a working product.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

The problem is that SDL gives almost no control over the sound stream, you cannot check to see how much of the buffer has played which makes it very hard to make the audio sync up with video. By writing my own driver for OSS and ALSA I will be able to do such things. SDL audio is pretty much designed for applications that do not need explicit timing of audio output and more designed for PC games, not emulators. Pretty much with OSS supported almost every OS will be supported. I may keep the SDL audio but it will not be the default for linux at least. OSS is open enough that it is supported in the linux kernel and freebsd which is pretty much most of the userbase anyway.
byuu

Post by byuu »

Wow. Video buffers that can't be stretched. Audio buffers that can't be used for streaming. Zero tie-ins to any kind of OS-native user interface. And it's still painfully slow.
Why in the hell is SDL so popular, anyway?

Seriously, checking the playback position of an audio buffer is necessary for just about anything besides playing short wave clips. Thanks for mentioning that pagefault, I'll be sure to avoid SDL audio completely now.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Because it's the only mainstream open source API foundation layer Linux has besides Allegro and straight up native coding that's cross-pltaform off x86 where the same code base can be used to create greater portability of C/C++ based applications.

Aerden stuff it up your ass sideways and go fart off. It's called discussion and everyone having a say. Page made his arguement and so did I, don't like it, don't post replies. He did finally bring up why though as it gives to control of streaming. He is right and I never noticed it right away till he brought it up. This could also be why some projects have SDL but also native OpenGL, ALSA, and other APIs coded natively. mPlayer is one that comes to mind about this.

Hmmm... maybe this could be requested of SDL to add things like this it needs. It never hurts to ask.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Just because SDL is supported on all of the major OSes and uses all the major APIs.. doesn't make it good.

Programmers pick the languages and tools that best suits their needs... it does really sound like SDL needs lots more work before it can be considered "good" by any stretch of the imagination... not to say that it's not used.. it's just not good for a specific purpose (it is probably better for a smaller general purpose)...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

People try to compare it to DirectX sometimes which isn't good. DirectX has lots more tools especially for debugging purposes SDL doesn't. Don't get me wrong. It's a great API to use but it really lacks debugging features most native and alternative APIs have.

One Audio API that ZSnes could use across Win32, UNIX, and a few other OSes, although it's not free is FMOD. It's a great toolkit, has good debugging tools, is one of a few APIs with 3D audio and environment extensions(well it and OpenAL are really well... it). And I doubt ZSnes would ever use it but it just one more one the list of availability.

I really wish ALSA could get it's own 3D audio engine or extensions. Sensaura, A3D, and EAX are all owned by Creative and most people know how they like to just give things away especially for 3D audio code. Sensaura and A3D are now both dead and Creative won't even let many if not anyone have Sensaura or A3D support anymore without a nasty fee.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Bahamut_ZERO_939 wrote:One Audio API that ZSnes could use across Win32, UNIX, and a few other OSes, although it's not free is FMOD. It's a great toolkit, has good debugging tools, is one of a few APIs with 3D audio and environment extensions(well it and OpenAL are really well... it). And I doubt ZSnes would ever use it but it just one more one the list of availability.
The purpose of FMOD was to be able to program sound and not worry about the details about a certain API.. like DirectSound and EAX. I've heard many good things about it. Snes9x uses it as well.

The real question is whether it is worth spending on and whether it causes conflicts with the ZSNES license... and you have to wonder if it is a good thing to program on (according to the devs).
I really wish ALSA could get it's own 3D audio engine or extensions. Sensaura, A3D, and EAX are all owned by Creative and most people know how they like to just give things away especially for 3D audio code. Sensaura and A3D are now both dead and Creative won't even let many if not anyone have Sensaura or A3D support anymore without a nasty fee.
It really doesn't matter (at least in ZSNES's case) whether or not it has support audio extensions. Sensura is used in the UT series though I never expected it to live (it had limited impact in the first place). A3D died with Aureal (yes Creative owns that now, but it's a dead API for all intents and purposes.. and it was mainly specific for Aureal based hardware originally). Creative isn't stopping anyone from using it.. there's just no support for it anymore (software developers see it as a dead end, hardware manufacturers aren't building hardware and writing drivers for it).

There's no point in introducing new stuff unless you have something worth looking at (and in this case it is not worth listening to). Unless you have a standard (or a closed standard to begin with initially) that is really good, it's just not going to matter. Audio technology really hasn't progressed the same way 3D rendering has... so it's not that surprising.
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 »

Bahamut_ZERO_939 wrote:One Audio API that ZSnes could use across Win32, UNIX, and a few other OSes, although it's not free is FMOD.
This answers itself.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

pagefault wrote:
Bahamut_ZERO_939 wrote:One Audio API that ZSnes could use across Win32, UNIX, and a few other OSes, although it's not free is FMOD.
This answers itself.
So.. is that what you're using or planning to use?
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 »

No, it means we won't use it because it's not free. We are using OSS/ALSA.
Spike
Rookie
Posts: 21
Joined: Mon Oct 10, 2005 12:02 pm

Post by Spike »

I use OSS output for all audio output when possible.
The only annoying issue is for people who have crappy soundcards that block the device while its in use.
People really need good soundcards that can play multiple streams in hardware such as any card based on an emu10k1 chipset.
Single stream capable chipsets like most onboard sound and intel audio are just plain garbage.
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

If that is a problem, they can use ALSA-dmix.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

The ALSA code is nearing completion. Once it has reaches a stable point OSS support will be added so there will be little problems with people using it on any flavour of unix.
Spike
Rookie
Posts: 21
Joined: Mon Oct 10, 2005 12:02 pm

Post by Spike »

Aerdan wrote:If that is a problem, they can use ALSA-dmix.
ALSA-dmix is just as bad as artsd or esd mixing. It sounds pretty crappy. dmix is just a cludge.
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

orly

I have *never* had extra line noise with dmix, I have *never* had to kill someone's zombied daemon with dmix.

In my view, it is the best option for software mixing available at this time.
Spike
Rookie
Posts: 21
Joined: Mon Oct 10, 2005 12:02 pm

Post by Spike »

Aerdan wrote:orly

I have *never* had extra line noise with dmix, I have *never* had to kill someone's zombied daemon with dmix.

In my view, it is the best option for software mixing available at this time.
Sure it is, considering its the only option out there that doesn't make use of a crappy daemon aside from a real dsp that can hardware mix.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Spike wrote:People really need good soundcards that can play multiple streams in hardware such as any card based on an emu10k1 chipset.
.
The problem is nobody wants to use Creative for Linux Audio, they have to because nobody wants to create a suitable driver with enough abilities to match Creative's. Creative does a lot for Linux audio, yes, but so could other chipset developers like Realtek, Nvidia, Intel, and others.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Pre-release code for the OSS output has been released. It is known to be buggy on some cards, please share your experience here.

http://zsnes.game-host.org/~pagefault/sdllink.c

Also if you have experience with OSS sound it would be appreciated to have some input on it. It works 100% fine on my card but on grinvader's and Nach's card it does not.
Spike
Rookie
Posts: 21
Joined: Mon Oct 10, 2005 12:02 pm

Post by Spike »

I got it working on my emu10k1.

if (ioctl(fdAudio, SNDCTL_DSP_SETFRAGMENT, "32") == -1)
fprintf(stderr, "Could not set PCM format on device.\n");

fragment size should be set to something sensible...

if (ioctl(fdAudio, SNDCTL_DSP_SPEED, &oss_samplerate) == -1)
fprintf(stderr, "Could not set PCM format on device.\n");

and of course set the samplerate!

Cheers.

Nice job tho, sounds really crisp now compared to that SDL junk.

Now the 100% cpu gremlin needs fixing....
Post Reply