src/main/java/org/jcodec/common/AudioUtil.java
public static void toFloat(AudioFormat format, ByteBuffer buf, FloatBuffer floatBuf) {
        if (!format.isSigned())
            throw new NotSupportedException("Unsigned PCM is not supported ( yet? ).");

        if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24)
            throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? ).");

        if (format.isBigEndian()) {
            if (format.getSampleSizeInBits() == 16) {
                toFloat16BE(buf, floatBuf);
            } else {
                toFloat24BE(buf, floatBuf);
            }
        } else {
            if (format.getSampleSizeInBits() == 16) {
                toFloat16LE(buf, floatBuf);
            } else {
                toFloat24LE(buf, floatBuf);
            }
        }
    }
public static void toFloat(AudioFormat format, ByteBuffer buf, FloatBuffer floatBuf) {
        if (!format.isSigned())
            throw new NotSupportedException("Unsigned PCM is not supported ( yet? ).");

        if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24)
            throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? ).");

        if (format.isBigEndian()) {
            if (format.getSampleSizeInBits() == 16) {
                toFloat16BE(buf, floatBuf);
            } else {
                toFloat24BE(buf, floatBuf);
            }
        } else {
            if (format.getSampleSizeInBits() == 16) {
                toFloat16LE(buf, floatBuf);
            } else {
                toFloat24LE(buf, floatBuf);
            }
        }
    }
public static void toFloat ( AudioFormat format , ByteBuffer buf , FloatBuffer floatBuf ) { if ( ! format . isSigned ( ) ) throw new NotSupportedException ( "Unsigned PCM is not supported ( yet? )." ) ; if ( format . getSampleSizeInBits ( ) != 16 && format . getSampleSizeInBits ( ) != 24 ) throw new NotSupportedException ( format . getSampleSizeInBits ( ) + " bit PCM is not supported ( yet? )." ) ; if ( format . isBigEndian ( ) ) { if ( format . getSampleSizeInBits ( ) == 16 ) { toFloat16BE ( buf , floatBuf ) ; } else { toFloat24BE ( buf , floatBuf ) ; } } else { if ( format . getSampleSizeInBits ( ) == 16 ) { toFloat16LE ( buf , floatBuf ) ; } else { toFloat24LE ( buf , floatBuf ) ; } } }
Converts PCM samples stored in buf and described with format to float
array representation

@param format
Supported formats - *_*_S16_LE, *_*_S24_LE, *_*_S16_BE,
*_*_S24_LE
@param buf
@param floatBuf
@return Total number of samples read from the buffer
Converts PCM samples stored in buf and described with format to float array representation