SDL audio

oops, turns out that function worked, and was actually getting the error
from SDL_OpenAudio, b/c the channels param wasn’t set.

sorry,
–Keith

Hello,
I need some more info about the sdl audio functions.

  1. What exactly the function SDL_MixAudio does ? and do i have to use it for playing data from my sound buffer ?
  2. Do i have any option to reset the sound card? because i have some problems when i send a vector filled with a sampled sin and i let it play in a loop callback function, after a few seconds it start to sound wrong not like a clean sin wave.
  3. What is the use of samples in the AudioSpec ? what difference does it make if i chose 512 or 4096 for example ?

thank’s
ofer.

Hmm, isnt this clear from the docs, e.g. look at
Documentation/Doc Project at www.libsdl.org
or in the SDL_audio.h file (at least for point 1 and 3).

You could also try to use the SDL_Mixer or SDL_sound library,
maybe look at the Downloads/Library section at www.libsdl.org to get
an overview/idea.

Thomas> ----- Original Message -----

From: weissblu@bgumail.bgu.ac.il (Weissblum Ofer)
To:
Sent: Thursday, March 06, 2003 11:23 AM
Subject: [SDL] SDL audio

Hello,
I need some more info about the sdl audio functions.

  1. What exactly the function SDL_MixAudio does ? and do i have to use it for playing data from my sound buffer ?
  2. Do i have any option to reset the sound card? because i have some problems when i send a vector filled with a sampled sin and i
    let it play in a loop callback function, after a few seconds it start to sound wrong not like a clean sin wave.
  3. What is the use of samples in the AudioSpec ? what difference does it make if i chose 512 or 4096 for example ?

thank’s
ofer.

Hello,
I need some more info about the sdl audio functions.

  1. What exactly the function SDL_MixAudio does ?

It just mixes sound into an output buffer. Don’t remember if it does
clipping, but you can find out by checking the docs and/or the
source.

and do i have to
use it for playing data from my sound buffer ?

Nope. It’s just a handy tool. I’ve written various SDL audio stuff,
including a rather advanced sound/synth engine, and actually never
used this call. :slight_smile:

  1. Do i have any
    option to reset the sound card?

Why would you ever want to do that? What do you mean by “reset”,
actually?

At least 99% of all sound applications have no use for such a feature,
because it just causes glitches. Many APIs have such a feature, but
the effect differs between cards, drivers and operating systems.

because i have some problems when i
send a vector filled with a sampled sin and i let it play in a loop
callback function, after a few seconds it start to sound wrong not
like a clean sin wave.

That’s because you made a mistake somewhere in your code. You should
be generating a continous stream of samples, no matter what. The
stream shouldn’t end or be interrupted until the application closes.
The fact that you deliver a bunch of samples at a time through the
callback is just an API detail.

  1. What is the use of samples in the
    AudioSpec ?

“Audio buffer size in samples”, just like it says in the docs…

what difference does it make if i chose 512 or 4096 for
example ?

Latency vs reliability. Smaller numbers give you lower latency. (Ie
less delay from whenever your code does something to when it becomes
audible.) Larger numbers reduce the risk of drop-outs and other
artifacts.

In games and other interactive apps, you generally want the lowest
possible latency (ie smallest possible buffer), but as platforms and
individual systems have different limits, I’d strongly recommend that
you make this user configurable, one way or another.

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Thursday 06 March 2003 11.23, Weissblum Ofer wrote:

i?m writing an application in which I want to play an audio file with as much timing accuracy as possible. It is a very short audio file (< 1 second) that need to be played at a very specific time with as little delay as possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i just need this single sound?

i found this info :

https://gist.github.com/armornick/3447121

and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !

Here’s a project I found a while ago, a SDL sound library aimed at
simplify audio implimentation for games. Disclaimer is that I haven’t
experimented with it yet…

http://sol.gfxile.net/soloud/index.html

Judging from the example on the front page it looks easy to pre-load a
sound clip and play it (exactly) when needed.

SimonOn Tue, March 8, 2016 7:28 am, jeroen clarysse wrote:

i???m writing an application in which I want to play an audio file with
as much timing accuracy as possible. It is a very short audio file (< 1
second) that need to be played at a very specific time with as little
delay as possible

hello,
soloud


will help you for this
you don’t need to implement audio callback or anything else

???-??-?? ??:?? +??:?? ???, jeroen clarysse <jeroen.clarysse at telenet.be>:> i?m writing an application in which I want to play an audio file with as

much timing accuracy as possible. It is a very short audio file (< 1 second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !


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

is this a wrapper AROUND sdl, or is this something that sits NEXT to sdl as a separate lib ?> On 08 Mar 2016, at 16:40, Amir Ramezani <amir.ramezani1370 at gmail.com> wrote:

hello,
soloud
http://github.com/jarikomppa/soloud/
will help you for this
you don’t need to implement audio callback or anything else

???-??-?? ??:?? +??:?? ???, jeroen clarysse <@Jeroen_Clarysse>:

i?m writing an application in which I want to play an audio file with as
much timing accuracy as possible. It is a very short audio file (< 1 second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !


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


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

it is an audio library for sdl, OpenAL, etc
it use’s sdl to play audio, but it has it’s own API

???-??-?? ??:?? +??:?? ???, jeroen clarysse <jeroen.clarysse at telenet.be>:> is this a wrapper AROUND sdl, or is this something that sits NEXT to sdl as

a separate lib ?

On 08 Mar 2016, at 16:40, Amir Ramezani <@Amir_Ramezani> wrote:

hello,
soloud
http://github.com/jarikomppa/soloud/
will help you for this
you don’t need to implement audio callback or anything else

???-??-?? ??:?? +??:?? ???, jeroen clarysse
<jeroen.clarysse at telenet.be>:

i?m writing an application in which I want to play an audio file with as
much timing accuracy as possible. It is a very short audio file (< 1
second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i
just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !


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


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


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

thanks !

i?m reading the documentation now and downloaded the zip. No project-files though, as far as I can see. I?m also not sure if it is crossplatform and will support XCode (also no XCode project files)> On 10 Mar 2016, at 10:02, Amir Ramezani <amir.ramezani1370 at gmail.com> wrote:

it is an audio library for sdl, OpenAL, etc
it use’s sdl to play audio, but it has it’s own API

???-??-?? ??:?? +??:?? ???, jeroen clarysse <@Jeroen_Clarysse>:

is this a wrapper AROUND sdl, or is this something that sits NEXT to sdl as
a separate lib ?

On 08 Mar 2016, at 16:40, Amir Ramezani <amir.ramezani1370 at gmail.com> wrote:

hello,
soloud
http://github.com/jarikomppa/soloud/
will help you for this
you don’t need to implement audio callback or anything else

???-??-?? ??:?? +??:?? ???, jeroen clarysse
<@Jeroen_Clarysse>:

i?m writing an application in which I want to play an audio file with as
much timing accuracy as possible. It is a very short audio file (< 1
second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i
just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !


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


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


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


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

hi again,
it is cross platform and use’s genie to build and as far as i know, it
support’s mac OSX, windows, linux

???-??-?? ??:?? +??:?? ???, jeroen clarysse <jeroen.clarysse at telenet.be>:> thanks !

i?m reading the documentation now and downloaded the zip. No project-files
though, as far as I can see. I?m also not sure if it is crossplatform and
will support XCode (also no XCode project files)

On 10 Mar 2016, at 10:02, Amir Ramezani <@Amir_Ramezani> wrote:

it is an audio library for sdl, OpenAL, etc
it use’s sdl to play audio, but it has it’s own API

???-??-?? ??:?? +??:?? ???, jeroen clarysse
<jeroen.clarysse at telenet.be>:

is this a wrapper AROUND sdl, or is this something that sits NEXT to sdl
as
a separate lib ?

On 08 Mar 2016, at 16:40, Amir Ramezani <@Amir_Ramezani> wrote:

hello,
soloud
http://github.com/jarikomppa/soloud/
will help you for this
you don’t need to implement audio callback or anything else

???-??-?? ??:?? +??:?? ???, jeroen clarysse
<jeroen.clarysse at telenet.be>:

i?m writing an application in which I want to play an audio file with
as
much timing accuracy as possible. It is a very short audio file (< 1
second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i
just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?

thx !


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


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


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


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


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

I would expect that first example should be sufficient. The truth is
that all the audio implementations you will find will do mixing. The
nice thing about that example for your case is that it only depends on
SDL and you don’t need additional libraries so your build process will
stay easy.

But if you really want another library, I’ll also plug ALmixer (by
me). It provides a similar API to SDL_mixer, but changes lift the
artificial distinction between Music and Sounds so you can have
multiple streams (not important to you. It is also built completely on
OpenAL. It was designed for low latency playback. I never intended it
for music apps, but I learned a bunch of people shipped music
instruments apps with it. :confused:

ALmixer now has native platform decoders for iOS/OS X (Core Audio),
Android (OpenSLES), and Windows (Windows Media Foundation), and uses
the usual suspects on Linux (wav, ogg). This attempts to remove the
bloat and simplify dependency hell and the build process. There is a
CMake build system I use to build for all the platforms.

I also have a new SDL based SDK in progress called Blurrr. It contains
prebuilt binaries for a lot of the SDL libraries and ALmixer. The idea
is you can just get going with an SDL project for all the major
platforms and not muck around with build systems and all the tiny
cross-platform details. Check out blurrrsdk.com. It’s still prelaunch,
but I’m looking for early adopters/testers. Anybody reading this, feel
free to contact me.

Thanks,
EricOn 3/8/16, jeroen clarysse <jeroen.clarysse at telenet.be> wrote:

i?m writing an application in which I want to play an audio file with as
much timing accuracy as possible. It is a very short audio file (< 1 second)
that need to be played at a very specific time with as little delay as
possible

how should I approach this ?

I?ve read the SDL_mixer docs but I don?t really want to mix anything? i just
need this single sound?

i found this info :

https://gist.github.com/armornick/3447121
and
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html

should that suffice ? Is this fast enough ?