Archived

This topic is now archived and is closed to further replies.

SDL Audio

This topic is 6009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Is this the same thing? http://www.libsdl.org

Share this post


Link to post
Share on other sites
Yeah, it''s just a little light on the tutorial side of things...

I think I''ve sorta figured it out.

To my surprise, the technique employed is to call the mixing functions yourself via callback functions and a couple built-in utilities. Seemed more daunting than it turned out to be.

Just can''t seem to get the conversion routines to work now...

where''s an expert when you need one?

Share this post


Link to post
Share on other sites
Any specifics on the problem you''re having with the conversion?
What format are you trying to convert from?

I''ve got a fair bit of SDL audio experience and could potentially help you out here.

The callback mixing IS a bit confusing at first. In the end it gives you a lot of freedom and power that would otherwise be very hard to abstract to the different low level audio libs like DirectSound, but SDL could really use some simple built-in LoadWavClip(), PlayAudio() type functions for getting simple audio up and playing when you don''t need that much flexibility.

Share this post


Link to post
Share on other sites
Well, the problem I''m having seems to be that resampling from 8000 (my file freq) to 22050 (my playback freq) doesn''t do anything -- it just plays faster.

I''ve heard there''s a potential problem if you don''t go by a factor of 2 up or down (like 22050 will work if sampling up from 11025, for example).

Share this post


Link to post
Share on other sites
I''ve never used SDL, but in general resampling should prove no problems other than a minor amount of degredation of quality to the signal. It sounds like you are playing the wavetable at a higher rate instead of resampling it. Resampling should take the signal and interpolate it so that it matches the original signal at a different rate. It is the error of the interpolation that results in a loss of quality. Changing just the sample rate will make the audio file play faster; for example, if a file with 8000 samples takes a second at 8000Hz, at 22050 it will take only 300ms-ish.

A possible solution would be to resample the files in an external program, such as GoldWave or SoundForge, and then use this with SDL. This would result in audio files about three times larger, but would solve the resampling problem.

If SDL permits it, maybe it would be easier to write your own audio routines. The canonical wave format is simple, and DirectSound provides a nice API.

Never used SDL, so sorry I can''t be of more help.

Share this post


Link to post
Share on other sites
I''m learning that SDL seems to only go as far as doing factors of two scales. For example, my 8Khz file when sampled up to 22Khz only makes it to 16Khz. Something about copyrighted sampling techinques or something. I''m obviously a little vague.

I think I''ll go ahead and resample everything to a common rate externally. So much for small size...

Maybe I''ll upsample my 22Khz file to 32Khz externally and that''ll let the SDL resampling work...

Share this post


Link to post
Share on other sites