Sound samplecount..can i change it?

Hi…

first what exactly does samplecount and frequancy
means…?

my problem:
i want to port an application which uses sound its
sample count is 512…it
works(sounds) fine…
but calling sdl_openaudi returns me (in that
platform)a very higher sample
count and so my sound doesnt work fine…
how can i playback it so it sound perfect again…

my whole callback function is just i memcpy my buffer
to that stream
function…(i do some other stuff but doing this also
sound not that
bad)…
so what should i do now to make it work perfect on
higher samplecounts…

or should i change lots of other things too?

Regards__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

Hi…

first what exactly does samplecount and frequancy
means…?

s/samplecount/samples/…?

Anyway, that’s the number of samples in a buffer. Keep in mind that
this is different from the size. Sizes are in bytes, whereas a
buffer of N samples may be N, 2N or 4N bytes, depending on the
sample format (8 or 16 bits) and number of channels (mono or stereo).

‘frequency’ is the number of samples played per second. You’d set this
to 44100 for “CD quality”, or something like 8000 for phone quality,
for example. These days, most sound cards seem to work best with
48000, since that’s what the converters are designed for and/or
because the cards run at that rate all the time internaly, no matter
what sample rates applications use.

my problem:
i want to port an application which uses sound its
sample count is 512…it
works(sounds) fine…
but calling sdl_openaudi returns me (in that
platform)a very higher sample
count and so my sound doesnt work fine…
how can i playback it so it sound perfect again…

my whole callback function is just i memcpy my buffer
to that stream
function…(i do some other stuff but doing this also
sound not that
bad)…
so what should i do now to make it work perfect on
higher samplecounts…

or should i change lots of other things too?

You have to be prepared for any buffer size, regardless of what you
ask for. Normally, you would just design all your audio code to be
callback driven with a similar interface to that of the SDL audio
callback. Every function is given some I/O buffers and are told to
process N samples. That way, it’s dead simple to build arbitrarilly
complex trees of DSP functions. The right number of samples are
generated for each audio callback, which minimizes latency and makes
it easier to avoid drastically varying callback execution times.

This is how all major audio plugin and I/O APIs like VST, TDM,
AudioUnits, LADSPA, DirectX, CoreAudio, PortAudio, ASIO, EASI, JACK,
ReWire etc work. It’s the only design that really works in anything
but the most trivial cases.

There is an example over at olofson.net. Though it’s not perfectly
nice and clean code(*), it demonstrates very basic mixing of
multichannel sound with the “raw” SDL audio API:

http://olofson.net/examples.html   (simplemixer-1.1)

(*) The main thread/audio callback interface is probably not
totally thread safe, although the worst thing that can
happin is that it drops an occasional sound. I think… :slight_smile:
I have a better version lying around that I’ll try to wrap
up and release some time. Anyway, this doesn’t have anything
to do with the actual mixing/DSP part; just those shared
variables used to start sounds from the main thread.

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

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 19 May 2004 21.46, Roozbeh GHolizadeh wrote: