[linux-audio-dev] 8bit sound wav playing to a 16bit sound card...

Steve Harris S.W.Harris at ecs.soton.ac.uk
Thu Jun 12 13:32:01 UTC 2003

On Thu, Jun 12, 2003 at 11:18:53AM -0400, Derrick wrote:
> I'm new to OSS Programming, and I'm attempting to play some 8bit wav files.
> However OSS is telling me that my sound card will not play 8bit , only 16bit.
> If I force it. The sound changes pitch, and is very fast. ( obviously ).
> Is there anyway to convert 8bit to 16bit on the fly? I've noticed that XMMS 
> also fails to play the 8bit wav file correctly. 

If you use libsndfile it will let you read in the data in whatever format
you like. http://www.zip.com.au/~erikd/libsndfile/
sf_read_short() will give you 16bit data regardless of the .wav file

NB. most people dont use OSS anymore though, its not a very good API, JACK
and ALSA are much better, though may require kernel modules to be added if
your running an OSS only system.

- Steve

More information about the Linux-audio-dev mailing list