tritonus-share/src/main/java/org/tritonus/share/sampled/FloatSampleTools.java
/**
	 * Conversion function to convert an interleaved byte array to a List of
	 * interleaved float arrays. The float arrays will contain normalized
	 * samples in the range [-1.0, +1.0]. The input array provides bytes in the
	 * format specified in <code>format</code>.
	 * <p>
	 * Only PCM formats are accepted. The method will convert all byte values
	 * from <code>input[inByteOffset]</code> to
	 * <code>input[inByteOffset + (frameCount * format.getFrameSize()) - 1]</code>
	 * to floats from <code>output(n)[outOffset]</code> to
	 * <code>output(n)[outOffset + frameCount - 1]</code>
	 * 
	 * @param input the audio data in an byte array
	 * @param inByteOffset index in input where to start the conversion
	 * @param output list of float[] arrays which receive the converted audio
	 *            data. if the list does not contain enough elements, or
	 *            individual float arrays are not large enough, they are
	 *            created.
	 * @param outOffset the start offset in <code>output</code>
	 * @param frameCount number of frames to be converted
	 * @param format the input format. Only packed PCM is allowed
	 * @param allowAddChannel if true, channels may be added to
	 *            <code>output</code> to match the number of input channels,
	 *            otherwise, only the first output.size() channels of input data
	 *            are converted.
	 * @throws IllegalArgumentException if one of the parameters is out of
	 *             bounds
	 * @see #byte2floatInterleaved(byte[],int,float[],int,int,AudioFormat)
	 */
Conversion function to convert an interleaved byte array to a List of
interleaved float arrays. The float arrays will contain normalized
samples in the range [-1.0, +1.0]. The input array provides bytes in the
format specified in format.

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

@param input the audio data in an byte array
@param inByteOffset index in input where to start the conversion
@param output list of float[] arrays which receive the converted audio
data. if the list does not contain enough elements, or
individual float arrays are not large enough, they are
created.
@param outOffset the start offset in output
@param frameCount number of frames to be converted
@param format the input format. Only packed PCM is allowed
@param allowAddChannel if true, channels may be added to
output to match the number of input channels,
otherwise, only the first output.size() channels of input data
are converted.
@throws IllegalArgumentException if one of the parameters is out of
bounds
@see #byte2floatInterleaved(byte[],int,float[],int,int,AudioFormat)
Conversion function to convert an interleaved byte array to a List of interleaved float arrays . The float arrays will contain normalized samples in the range [ - 1 . 0 + 1 . 0 ] . The input array provides bytes in the format specified in format . Only PCM formats are accepted . The method will convert all byte values from input [ inByteOffset ] to input [ inByteOffset + ( frameCount * format . getFrameSize () ) - 1 ] to floats from output ( n ) [ outOffset ] to output ( n ) [ outOffset + frameCount - 1 ] @param input the audio data in an byte array @param inByteOffset index in input where to start the conversion @param output list of float [] arrays which receive the converted audio data . if the list does not contain enough elements or individual float arrays are not large enough they are created . @param outOffset the start offset in output @param frameCount number of frames to be converted @param format the input format . Only packed PCM is allowed @param allowAddChannel if true channels may be added to output to match the number of input channels otherwise only the first output . size () channels of input data are converted . @throws IllegalArgumentException if one of the parameters is out of bounds @see #byte2floatInterleaved ( byte [] int float [] int int AudioFormat )
public static void byte2float(byte[] input, int inByteOffset,
			List<float[]> output, int outOffset, int frameCount,
			AudioFormat format, boolean allowAddChannel) {
		int channels = format.getChannels();
		if (!allowAddChannel && channels > output.size()) {
			channels = output.size();
		}
		for (int channel = 0; channel < channels; channel++) {
			float[] data;
			if (output.size() < channel) {
				data = new float[frameCount + outOffset];
				output.add(data);
			} else {
				data = output.get(channel);
				if (data.length < frameCount + outOffset) {
					data = new float[frameCount + outOffset];
					output.set(channel, data);
				}
			}
			byte2floatGeneric(input, inByteOffset, format.getFrameSize(), data,
					outOffset, frameCount, format);
			inByteOffset += format.getFrameSize() / format.getChannels();
		}
	}
public static void byte2float ( byte [ ] input , int inByteOffset , List < float [ ] > output , int outOffset , int frameCount , AudioFormat format , boolean allowAddChannel ) { int channels = format . getChannels ( ) ; if ( ! allowAddChannel && channels > output . size ( ) ) { channels = output . size ( ) ; } for ( int channel = 0 ; channel < channels ; channel ++ ) { float [ ] data ; if ( output . size ( ) < channel ) { data = new float [ frameCount + outOffset ] ; output . add ( data ) ; } else { data = output . get ( channel ) ; if ( data . length < frameCount + outOffset ) { data = new float [ frameCount + outOffset ] ; output . set ( channel , data ) ; } } byte2floatGeneric ( input , inByteOffset , format . getFrameSize ( ) , data , outOffset , frameCount , format ) ; inByteOffset += format . getFrameSize ( ) / format . getChannels ( ) ; } }
Conversion function to convert an interleaved byte array to a List of
 interleaved float arrays.
Conversion function to convert an interleaved byte array to a List of interleaved float arrays .