lib/minim/src/ddf/minim/javasound/FloatSampleTools.java
/**
	 * Conversion function to convert a non-interleaved float audio data to an
	 * interleaved byte array. The float arrays contains normalized samples in
	 * the range [-1.0f, +1.0f]. The output array will receive bytes in the
	 * format specified in <code>format</code>. Exactly
	 * <code>format.getChannels()</code> channels are converted regardless of
	 * the number of elements in <code>input</code>. If <code>input</code>
	 * does not provide enough channels, an </code>IllegalArgumentException<code>
	 * is thrown.
	 * <p>
	 * Only PCM formats are accepted. The method will convert all samples from
	 * <code>input(n)[inOffset]</code> to
	 * <code>input(n)[inOffset + frameCount - 1]</code> to byte values from
	 * <code>output[outByteOffset]</code> to
	 * <code>output[outByteOffset + (frameCount * format.getFrameSize()) - 1]</code>
	 * <p>
	 * Dithering should be used when the output resolution is significantly
	 * lower than the original resolution. This includes if the original data
	 * was 16-bit and it is now converted to 8-bit, or if the data was generated
	 * in the float domain. No dithering need to be used if the original sample
	 * data was in e.g. 8-bit and the resulting output data has a higher
	 * resolution. If dithering is used, a sensitive value is
	 * DEFAULT_DITHER_BITS.
	 * 
	 * @param input a List of float arrays with the input audio data
	 * @param inOffset index in the input arrays where to start the conversion
	 * @param output the byte array that receives the converted audio data
	 * @param outByteOffset the start offset in <code>output</code>
	 * @param frameCount number of frames to be converted.
	 * @param format the output format. Only packed PCM is allowed
	 * @param ditherBits if 0, do not dither. Otherwise the number of bits to be
	 *            dithered
	 * @throws IllegalArgumentException if one of the parameters is out of
	 *             bounds
	 * @see #DEFAULT_DITHER_BITS
	 * @see #float2byteInterleaved(float[],int,byte[],int,int,AudioFormat,float)
	 */
Conversion function to convert a non-interleaved float audio data to an
interleaved byte array. The float arrays contains normalized samples in
the range [-1.0f, +1.0f]. The output array will receive bytes in the
format specified in format. Exactly
format.getChannels() channels are converted regardless of
the number of elements in input. If input
does not provide enough channels, an IllegalArgumentException
is thrown.

Only PCM formats are accepted. The method will convert all samples from
input(n)[inOffset] to
input(n)[inOffset + frameCount - 1] to byte values from
output[outByteOffset] to
output[outByteOffset + (frameCount * format.getFrameSize()) - 1]

Dithering should be used when the output resolution is significantly
lower than the original resolution. This includes if the original data
was 16-bit and it is now converted to 8-bit, or if the data was generated
in the float domain. No dithering need to be used if the original sample
data was in e.g. 8-bit and the resulting output data has a higher
resolution. If dithering is used, a sensitive value is
DEFAULT_DITHER_BITS.


Conversion function to convert a non - interleaved float audio data to an interleaved byte array . The float arrays contains normalized samples in the range [ - 1 . 0f + 1 . 0f ] . The output array will receive bytes in the format specified in format . Exactly format . getChannels () channels are converted regardless of the number of elements in input . If input does not provide enough channels an IllegalArgumentException is thrown . Only PCM formats are accepted . The method will convert all samples from input ( n ) [ inOffset ] to input ( n ) [ inOffset + frameCount - 1 ] to byte values from output [ outByteOffset ] to output [ outByteOffset + ( frameCount * format . getFrameSize () ) - 1 ] Dithering should be used when the output resolution is significantly lower than the original resolution . This includes if the original data was 16 - bit and it is now converted to 8 - bit or if the data was generated in the float domain . No dithering need to be used if the original sample data was in e . g . 8 - bit and the resulting output data has a higher resolution . If dithering is used a sensitive value is DEFAULT_DITHER_BITS .
public static void float2byte(List<float[]> input, int inOffset,
			byte[] output, int outByteOffset, int frameCount,
			AudioFormat format, float ditherBits) {
		for (int channel = 0; channel < format.getChannels(); channel++) {
			float[] data = input.get(channel);
			float2byteGeneric(data, inOffset, output, outByteOffset,
					format.getFrameSize(), frameCount, format, ditherBits);
			outByteOffset += format.getFrameSize() / format.getChannels();
		}
	}
public static void float2byte ( List < float [ ] > input , int inOffset , byte [ ] output , int outByteOffset , int frameCount , AudioFormat format , float ditherBits ) { for ( int channel = 0 ; channel < format . getChannels ( ) ; channel ++ ) { float [ ] data = input . get ( channel ) ; float2byteGeneric ( data , inOffset , output , outByteOffset , format . getFrameSize ( ) , frameCount , format , ditherBits ) ; outByteOffset += format . getFrameSize ( ) / format . getChannels ( ) ; } }
Conversion function to convert a non-interleaved float audio data to an
 interleaved byte array.
Conversion function to convert a non - interleaved float audio data to an interleaved byte array .