question: public static void play ( double sample ) { if ( Double . isNaN ( sample ) ) throw new IllegalArgumentException ( "sample is NaN" ) ; if ( sample < - 1.0 ) sample = - 1.0 ; if ( sample > + 1.0 ) sample = + 1.0 ; short s = ( short ) ( MAX_16_BIT * sample ) ; buffer [ bufferSize ++ ] = ( byte ) s ; buffer [ bufferSize ++ ] = ( byte ) ( s > > 8 ) ; if ( bufferSize >= buffer . length ) { line . write ( buffer , 0 , buffer . length ) ; bufferSize = 0 ; } }
target:  Writes one sample (between -1.0 and +1.0) to standard audio. If the sample is outside the range, it will be clipped.