To play a sound of with a specific tone,we first have to create a sine wave sound.This is done in the following way.
final int duration = 10; // duration of sound
final int sampleRate = 22050; // Hz (maximum frequency is 7902.13Hz (B8))
final int numSamples = duration * sampleRate;
final double ...