Examples for SDL_sound

Hi there all…

In my game, I’d like to play an Impulse Tracker (.it) module and use OGG
samples for sfx… So far I was using SDL_mixer and all was fine but it
seems like SDL_mixer can’t use OGG for samples (correct me if I’m wrong). I
think SDL_sound can… But since SDL_sound seems more complex than
SDL_mixer, before trying it the hard way (learning the API), I’d like to
know if there are examples of doing something similar, somewhere out
there…

Thanks,
Ga?tan.

In my game, I’d like to play an Impulse Tracker (.it) module and use OGG
samples for sfx…

Seems like overkill and a waste of CPU power to play back OGG files for
sound effects. Why not convert them to wave via the Ogg/Vorbis library and
just use the standard SDL routines for audio?

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

Seems like overkill and a waste of CPU power to play back OGG files for
sound effects. Why not convert them to wave via the Ogg/Vorbis library and
just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…

-Ga?tan.

Convert them at runtime, then. WAV is going to be considerably faster
to play than OGG or MP3 for things like sound effects.

Use MPG and OGG for what they were meant for - long tracks of audio/music.

-bill!On Thu, Aug 01, 2002 at 12:17:25AM +0200, Ga?tan de Menten wrote:

Seems like overkill and a waste of CPU power to play back OGG files for
sound effects. Why not convert them to wave via the Ogg/Vorbis library and
just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…

sound effects. Why not convert them to wave via the Ogg/Vorbis library and
just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…

I wonder what would take more space - the addition of SDL_sound and
associated buffers or your sound effects being converted to raw form. :wink:

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

Seems like overkill and a waste of CPU power to play back OGG files
for

sound effects. Why not convert them to wave via the Ogg/Vorbis library
and

just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…

Convert them at runtime, then. WAV is going to be considerably faster
to play than OGG or MP3 for things like sound effects.
oups, didn’t think about this… good idea… :wink:

Thanks,
Ga?tan.> On Thu, Aug 01, 2002 at 12:17:25AM +0200, Ga?tan de Menten wrote:

In my game, I’d like to play an Impulse Tracker (.it) module and use OGG
samples for sfx… So far I was using SDL_mixer and all was fine but it
seems like SDL_mixer can’t use OGG for samples (correct me if I’m wrong).
I
think SDL_sound can… But since SDL_sound seems more complex than
SDL_mixer, before trying it the hard way (learning the API), I’d like to
know if there are examples of doing something similar, somewhere out
there…

Even though I’m now convinced what I wanted to do was foolish, I think there
should be some more examples included in SDL_sound… At least one playing
music and sfx… Coz, from what I’ve seen the example provided (playsound)
provided only plays one sound at a time… with lots of options but well…
Even if it’s simple (I really dunno in fact) it’d really be nice to have
such an example…

-Ga?tan.

In this discussion on space no one specified if they are tyring to limit
post-install space or pre-install space. I’ve seen warez coders ship sound
files in MP3 form and then convert to the appropriate format at install
time. Depending on when you need small file space, this discussion can vary.

~Rob> ----- Original Message -----

From: Neil Bradley [mailto:nb@synthcom.com]
Sent: Wednesday, July 31, 2002 3:38 PM
To: sdl at libsdl.org
Subject: Re: [SDL] Examples for SDL_sound

sound effects. Why not convert them to wave via the Ogg/Vorbis library
and

just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…

I wonder what would take more space - the addition of SDL_sound and
associated buffers or your sound effects being converted to raw form. :wink:

–>Neil



Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Seems like overkill and a waste of CPU power to play back OGG files
sound effects. Why not convert them to wave via the Ogg/Vorbis library
just use the standard SDL routines for audio?
Coz it takes more space and I’m trying to keep my game as tiny as
possible…
Convert them at runtime, then. WAV is going to be considerably faster
to play than OGG or MP3 for things like sound effects.

That’s what I meant originally. :wink: If you have any trouble mixing audio,
let me know and I’d be happy to help you out. Mixing is NOT difficult.

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

— Ga?tan_de_Menten wrote:

Even though I’m now convinced what I wanted to do
was foolish, I think there
should be some more examples included in
SDL_sound… At least one playing
music and sfx… Coz, from what I’ve seen the
example provided (playsound)
provided only plays one sound at a time… with lots
of options but well…
Even if it’s simple (I really dunno in fact) it’d
really be nice to have
such an example…

I disagree that such ideas are foolish. Sound
decompression really doesn’t take much CPU time on
modern hardware, and not using it seemingly wastes
disk space for no good reason (unless you are indeed
targeting low-end hardware)… There are arguments
both for and against, and it does depend on the
application.

-Loren__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better

provided only plays one sound at a time… with lots
of options but well…
Even if it’s simple (I really dunno in fact) it’d
really be nice to have
such an example…
I disagree that such ideas are foolish. Sound
decompression really doesn’t take much CPU time on
modern hardware,

True, but even MP3 decoding takes 10-15% of the CPU power of a Pentium
III/1Ghz (source=Winamp). Provided that we’re talking about streaming, on
the fly decodes, that’s 10-15% of the CPU that could be donig something
else, like making higher frame rates or better yet - sleeping. :wink: For
desktop machines it’s not much of a concern but laptops, an additional
10-20 minutes of play time is a good thing!

and not using it seemingly wastes
disk space for no good reason (unless you are indeed
targeting low-end hardware)… There are arguments
both for and against, and it does depend on the
application.

Absolutely, and the target system/audience.

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

One solution to this whole deal is to store the sound in Ogg, MP3, etc on
disk. Then, when code requests a sound file, load it, decompress it, and
cache the result. Any subsequent requests will use the decompressed cached
version. You can write your code to also support preloading sounds for
flexibility. This solution requires enough memeory to handle the
decompressed sound files of course.

~Rob> ----- Original Message -----

From: Neil Bradley [mailto:nb@synthcom.com]
Sent: Thursday, August 01, 2002 10:09 AM
To: sdl at libsdl.org
Subject: Re: [SDL] Examples for SDL_sound

provided only plays one sound at a time… with lots
of options but well…
Even if it’s simple (I really dunno in fact) it’d
really be nice to have
such an example…
I disagree that such ideas are foolish. Sound
decompression really doesn’t take much CPU time on
modern hardware,

True, but even MP3 decoding takes 10-15% of the CPU power of a Pentium
III/1Ghz (source=Winamp). Provided that we’re talking about streaming, on
the fly decodes, that’s 10-15% of the CPU that could be donig something
else, like making higher frame rates or better yet - sleeping. :wink: For
desktop machines it’s not much of a concern but laptops, an additional
10-20 minutes of play time is a good thing!

and not using it seemingly wastes
disk space for no good reason (unless you are indeed
targeting low-end hardware)… There are arguments
both for and against, and it does depend on the
application.

Absolutely, and the target system/audience.

–>Neil



Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Neil Bradley wrote:

True, but even MP3 decoding takes 10-15% of the CPU power of a Pentium
III/1Ghz (source=Winamp). Provided that we’re talking about streaming, on
the fly decodes, that’s 10-15% of the CPU that could be donig something
else, like making higher frame rates or better yet - sleeping. :wink: For
desktop machines it’s not much of a concern but laptops, an additional
10-20 minutes of play time is a good thing!

Hmm… Running xmms on linux with Duron 650/SB Live takes less than one
percent of the CPU. Yeah, winamp on windows takes much more but it
doesn’t say that the decoder thread is really taking all the CPU power
wasted.–
Mikko