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_S32_NE sample format

32 bit native endian sample format


AFMT_S32_NE is not a new sample format but just a convenience macro that is defined ad AFMT_S32_LE or AFMT_S32_BE depending on the endianess of the processor. It always maps to the native endianess of the system.

This format equals to an array of 32 bit integers (int) in all systems. Full 32 bit value range is permitted. However the least significant bits will be ignored by the devices. For example if this format is used with 24 bit devices then the value will be divided by 256 before playback. 16 bit devices will discard the 16 least significant bits (by dividing the value bu 65536). Recording works in opposite way. The least significant bits will be zeroes.

It's actually possible to detect the real sample precision by looking at the low significant bits of recorded samples. If the 12 least significant bits are always zero then the device apparently has just 20 bits of precision. However sample rate conversions performed by OSS or the hardware as well as on board digital mixers and effect units will fake this kind of detection code. Any arithmetic operations performed on the samples will make it look like the device has full 32 bit precision.

AFMT_S32_NE is totally unsuitable to be used as a file or transport format of audio data. It must only be used for samples generated or used locally in the application. AFMT_S32_LE is the recommended external sample format for 32 bit audio data because it's the industry standard.

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