[SDL] SDL useful for sound synthesis?

Louis Desjardins lost_bits1110 at hotmail.com
Thu Sep 21 11:23:47 PDT 2006


Hi everyone!

Thank you so much for your responses! This will surely help me a lot, I 
truly appreciate it.
Just one last thing..! :s

I guess when browsing through the SDL examples I was under the impression 
that most SDL users who use its sound capability already have their wav 
files (or whatever the format their audio is in) and just play this back and 
maybe add some effects or something. This is why I wasn't sure if I could 
use SDL to feed in my very own synthesized sound (i.e. simply a binary array 
of short int's or something) and have it play on-the-fly (i.e. soon after 
each sound chunk is processed) and in real-time.

Since I'm not doing game programming, but rather I am making a simulation 
program, I was considering OpenAL - which is a library just for audio. Does 
anyone know if OpenAL might be more advantageous/disadvantageous for what 
I'm trying to do?

Thanks again!  Hopefully I can be the expert one day and help others!

LD


>From: David Olofson <david at olofson.net>
>Reply-To: "A list for developers using the SDL library. 
>(includesSDL-announce)" <sdl at libsdl.org>
>To: "A list for developers using the SDL library. (includes 
>SDL-announce)"<sdl at libsdl.org>
>Subject: Re: [SDL] SDL useful for sound synthesis?
>Date: Thu, 21 Sep 2006 20:09:21 +0200
>
>On Thursday 21 September 2006 19:12, Waltzer George wrote:
>[...]
> > I think that's the clasic problem trying to stream anything,
> > regardless if audio or video.
>
>Real time sound synthesis is quite different from streaming, in that
>you essentially want zero latency. That is, you can't use any
>buffering beyond what the audio subsystem needs to avoid glitches, or
>you lose the whole point of trying to keep the audio output latency
>low in the first place.
>
>
>[...]
> > How to do this without clicks and ugly stuff? Use the treading
> > posibility of SDL,
> > create a thread(there are tutorials about this). You should play
> > from within that tread.
>
>I would strongly recommend *not* using any extra threads for low
>latency audio on most platforms. It increases the risk of operating
>system "coffee breaks" interfering with your audio, and you need
>additional buffering between each pair of threads in the chain,
>adding to the total latency.
>
>SDL already provides an audio thread on platforms that need it, and
>your best bet is to do all audio processing in that thread, that is,
>in the context of the callback from SDL audio.
>
>
>That said, there *are* low latency audio subsystems that use multiple
>threads or even processes to great effect (http://jackaudio.org/),
>but getting that to work reliably can be hard, if at all possible, on
>some platforms. "Don't try this at home!" ;-)
>
>
>//David Olofson - Programmer, Composer, Open Source Advocate
>
>.-------  http://olofson.net - Games, SDL examples  -------.
>|        http://zeespace.net - 2.5D rendering engine       |
>|       http://audiality.org - Music/audio engine          |
>|     http://eel.olofson.net - Real time scripting         |
>'--  http://www.reologica.se - Rheology instrumentation  --'
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl

_________________________________________________________________
Try the new Live Search today!  
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG





More information about the SDL mailing list