Assuming your float array contains PCM data and you want to play it in 8-bit mode, it is easy to convert it to a byte array:
int off=(signed!=0 ? 0 : 128); for(int i=0; i<samples; i++){ val=(int)(pcm[i]*128. + 0.5); if(val>127) val=127; else if(val<-128) val=-128; buffer[index++]=(byte)(val+off); } }
This code is a slightly modified code from JOrbis, here pcm is your float array, and buffer is an array of bytes.
Denis tulskiy
source share