Open Sound System
OSS 4.x Programmer's Guide

Do you have problems with sound/audio application development? Don't panic! Click here for help!

AFMT_FLOAT sample format

Single precision floating point formast (not recommended)


There is no need to pay any attention on this format in applications.

The reason why this format is defined is that it's a good format to be used internally by the applications. It uses 24 bits for mantissa which is the same used by the high end audio devices. At the same time the large numeric range of float makes it easier to maintain precision in certain algorithms. If fixed point is used it's possible that some results get truncated to zero while in flating point the value is stored with precision of 24 bits.

This format is the native single precision floating point format (float in C/C++) used by the computer architecture the computer is running. Values are scaled to the -1.0 to 1.0 range. Sample values outside this range will cause clipping distortion.

Most processor architectures use the IEEE float format but this is not necessarily the case. The AFMT_FLOAT format is not designed to be portable or to be used as a storage format in files. If an application wants to do this it must make sure it uses proper conversions between the "external" format and the "native" AFMT_FLOAT format.

When an application records audio it can be converted to the AFMT_FLOAT format simply by dividing the "linear" sample by the maximum sample value. Before playback the conversion needs to be done in opposite direction.

Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site