Code example for AudioTrack

Methods: playsetStereoVolumewrite

	 *       channels specified by the params. 
	 * @param left Boolean. True outputs to left channel. False, no output to left channel 
	 * @param right Boolean. True outputs to right channel. False, no output to right channel 
	public static void playSound(float left, float right) {
		final AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
				sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO,
				AudioFormat.ENCODING_PCM_16BIT, generatedSnd.length,
		Float leftVolume = left;
		Float rightVolume = right;
//		if (left) 
//			leftVolume = AudioTrack.getMaxVolume(); 
//		else 
//			leftVolume = AudioTrack.getMinVolume(); 
//		if (right) 
//			rightVolume = AudioTrack.getMaxVolume(); 
//		else 
//			rightVolume = AudioTrack.getMinVolume(); 
		audioTrack.write(generatedSnd, 0, generatedSnd.length);
		audioTrack.setStereoVolume(leftVolume, rightVolume);;
		Log.d("Main", "played");
	 * Sets all necessary fields. Should only be called from {@link genTone(dur, 
Connect your IDE to all the code out there  Get Codota for Java