SDL Mixer Vs. SDL Sound

I am just wondering what the main difference between SDL Mixer and SDL Sound support libraries. From what I can tell, SDL Mixer is better supported and both seem to be similar or the same library.

SDL_sound is just focused on decoding, while SDL_mixer does both
decoding and playback. The long term plan has been to replace
SDL_mixer’s decoding backend to use SDL_sound.

-EricOn 11/22/09, C.W. Betts wrote:

I am just wondering what the main difference between SDL Mixer and SDL Sound
support libraries. From what I can tell, SDL Mixer is better supported and
both seem to be similar or the same library.


[…]

SDL_sound is just focused on decoding, while SDL_mixer does both
decoding and playback. The long term plan has been to replace
SDL_mixer’s decoding backend to use SDL_sound.

Speaking of which, there has also been discussion on desired features for a
future SDL_mixer (or replacement) like that. Apart from treating music and
sound effects the same (for crossfading songs etc), some users have asked for
real time pitch control and other stuff like that.

Has there been any work done on this?

(I’ll need something like this soon. Just thinking it might be a better idea
to collaborate around an SDL_mixer evolution/replacement, instead of me
hacking it as an integral part of my next sound engine.)On Tuesday 24 November 2009, at 00.24.22, “E. Wing” wrote:

–
//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
‘---------------------------------------------------------------------’

1 Like

how about rewriting sdl_mixer as a contex creator for openal, much like sdl
can be a contex creator for opengl?
openal is fullycrossplatform and can handle much more events, queues and
effects, as well as 3d sound!

what do you think of this idea?
VittorioOn Tue, Nov 24, 2009 at 1:53 AM, David Olofson wrote:

On Tuesday 24 November 2009, at 00.24.22, “E. Wing” wrote:
[…]

SDL_sound is just focused on decoding, while SDL_mixer does both
decoding and playback. The long term plan has been to replace
SDL_mixer’s decoding backend to use SDL_sound.

Speaking of which, there has also been discussion on desired features for a
future SDL_mixer (or replacement) like that. Apart from treating music and
sound effects the same (for crossfading songs etc), some users have asked
for
real time pitch control and other stuff like that.

Has there been any work done on this?

(I’ll need something like this soon. Just thinking it might be a better
idea
to collaborate around an SDL_mixer evolution/replacement, instead of me
hacking it as an integral part of my next sound engine.)

–
//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
‘---------------------------------------------------------------------’


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

–

Marie von Ebner-Eschenbachhttp://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html

  • “Even a stopped clock is right twice a day.”

I don’t know… It might do the job in most of the cases where SDL_mixer is
used. What I have in mind is something that can also serve as a back-end for
MOD players, MIDI players, synthesizers etc - that is, basically what you want
from a serious sound effects engine, with the addition of (at least)
millisecond accurate timing.

Does OpenAL provide sufficient timing accuracy for music? (On the “note-by-
note” level, that is; not streaming.)

How does it scale to low end integer-only CPUs?

Either way, does OpenAL actually need a context creator for portability…?On Tuesday 24 November 2009, at 02.26.24, “Vittorio G.” <vitto.giova at yahoo.it> wrote:

how about rewriting sdl_mixer as a contex creator for openal, much like sdl
can be a contex creator for opengl?
openal is fullycrossplatform and can handle much more events, queues and
effects, as well as 3d sound!

what do you think of this idea?

–
//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
‘---------------------------------------------------------------------’

how about rewriting sdl_mixer as a contex creator for openal, much like
sdl
can be a contex creator for opengl?
openal is fullycrossplatform and can handle much more events, queues and
effects, as well as 3d sound!

what do you think of this idea?

I don’t know… It might do the job in most of the cases where SDL_mixer is
used. What I have in mind is something that can also serve as a back-end
for
MOD players, MIDI players, synthesizers etc - that is, basically what you
want
from a serious sound effects engine, with the addition of (at least)
millisecond accurate timing.

Well openal is used to reproduce any kind of sound data that is loaded in
source data, so as long as the stream is properly decoded there should be no
problem in reproducing any sound! For example a wav file can be played
directly by loading in memory its pcm data, but also an ogg file by decoding
it first.
I don’t have experience about midi and mods but i suppose that they are
files with one heades and some data that can be read using information
contained in the header… but let’s think about it: do we need openal
features for some midi effects? we could leave the old decoder in sdl_mixer
for such files

Does OpenAL provide sufficient timing accuracy for music? (On the “note-by-
note” level, that is; not streaming.)

i believe so, but i haven’t digged enough in the api to support my statement

How does it scale to low end integer-only CPUs?

Either way, does OpenAL actually need a context creator for portability…?

Well there was the equivalent GLUT library, that is ALUT, but it’s not
officially part of the standard and support has been controversial… right
now it’s pretty much dead and replaced by ALURE
and, no, you can create your own contex creator and write yourself the
various loaders, but that’s where SDL_mixer would come in play! If SDL_mixer
provided a simple way to initialize the context, select wheter hardware or
software sound, and load wav, mp3 and ogg files easily (also in streaming),
then the user would exposed to all the OpenAL API, which would work on
windows/linux/macos (iphone included)

VittorioOn Tue, Nov 24, 2009 at 8:20 AM, David Olofson wrote:

On Tuesday 24 November 2009, at 02.26.24, “Vittorio G.” < vitto.giova at yahoo.it> wrote:

–

Charles de Gaullehttp://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html

  • “The better I get to know men, the more I find myself loving dogs.”

[…]

Well openal is used to reproduce any kind of sound data that is loaded in
source data, so as long as the stream is properly decoded there should be
no problem in reproducing any sound! For example a wav file can be played
directly by loading in memory its pcm data, but also an ogg file by
decoding it first.

Yes, I know that much - but what I’m talking about is quite a bit beyond just
correctly playing back pre-rendered raw audio “approximately” when you want it
played.

Anyway, I’ve been browsing the OpenAL documentation, trying to find out if
it’s capable of doing what I need.

I don’t have experience about midi and mods but i suppose that they are
files with one heades and some data that can be read using information
contained in the header… but let’s think about it: do we need openal
features for some midi effects? we could leave the old decoder in sdl_mixer
for such files

Well, yes, one could hack that out of SDL_mixer - or just use SDL_sound, which
is already designed to be used like that. :slight_smile:

However, it’s not always an option to decode the whole file and just play back
the raw data. Handheld devices are rather popular these days - and they
generally don’t have the kind of memory you’d need to hold full songs in raw
format. Looped songs, interactive music and stuff like that also needs
streaming. (Well, you could “fake” some of that if you have some way of
starting buffers with sample accurate timing…)

Anyway, OpenAL seems to handle this just fine with alSourceQueueBuffers() and
friends. (Asynchronous buffering, so you don’t have to worry about callbacks
running in “real time context”.)

The problem with that is that it provides only this interface - no “real
time context” callbacks. So, apparently, you cannot implement custom real time
processing with minimal and consistent latency - which is pretty much the core
of what I intend to do.

And, I can see why OpenAL is designed this way too: This sort of “audio
context hacking” just doesn’t mix very well with hardware acceleration, in
much the same way that hardware accelerated graphics rendering doesn’t mix too
well with software rendering. The CPU/“specialized hardware” synchronization
and interaction would need to go way beyond what a general purpose OS and
standard drivers can support. (Doing this all in software is bad enough, and
that’s just one critical deadline per audio buffer…! Each
hardware/software connection adds another such point.)

As to “decoding” MODs and MIDIs, I’m not talking about rendering them into raw
audio using a complete synth/sampler, but rather using this new “mixer” to
play and mix individual sounds.

The critical part here is the timing, which needs to be millisecond accurate
or better; preferably sample accurate. There’s no way you’ll ever accomplish
that without direct callbacks from the audio thread (which BTW may not even
exist on the software side when using hardware acceleration), or timestamped
commands/events. AFAICT from the documentation, OpenAL provides neither.

Does OpenAL provide sufficient timing accuracy for music? (On the
“note-by- note” level, that is; not streaming.)

i believe so, but i haven’t digged enough in the api to support my
statement

I cannot see how that would be possible with the OpenAL 1.1 API, but I could
be missing something… No mention of timestamps or anything like that, and
the Source state transition commands (alSourcePlay() and co) have no other
arguments than the names of the objects to operate on.

I suppose OpenAL does timestamp those calls internally to maintain somewhat
constant latency, but that’s nowhere near sufficient for music on a normal
operating system. You’d need to run the music calls from a thread that’s
scheduled with millisecond accurate timing, which is just barely possible with
a properly configured Mac OS X or Linux audio workstation.

How does it scale to low end integer-only CPUs?

Either way, does OpenAL actually need a context creator for
portability…?

Well there was the equivalent GLUT library, that is ALUT, but it’s not
officially part of the standard and support has been controversial… right
now it’s pretty much dead and replaced by ALURE
and, no, you can create your own contex creator and write yourself the
various loaders, but that’s where SDL_mixer would come in play!

I see… That would be motivated then, I guess.

If SDL_mixer provided a simple way to initialize the context, select wheter
hardware or software sound, and load wav, mp3 and ogg files easily (also
in streaming), then the user would exposed to all the OpenAL API, which
would work on windows/linux/macos (iphone included)

That would be nice, of course.

Anyway, it seems like that “sampler/synth/mixer” thing I want would still need
it’s own mixer then. Of course, you could have it stream through an OpenAL
Source, if you want to use OpenAL as well… That mixer and the related code
(application or third party libraries) would do their sample accurate timing
stuff in “virtual time”, and just output a raw audio stream to send to your
audio output API of choice.On Tuesday 24 November 2009, at 16.33.56, “Vittorio G.” <vitto.giova at yahoo.it> wrote:

–
//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
‘---------------------------------------------------------------------’