Continuously Playing a Sampled Audio File

Only DataLine objects that are of type Clip can be repeated. To create a clip, see Loading and Playing Sampled Audio.
// Play once clip.start(); // Play and loop forever clip.loop(Clip.LOOP_CONTINUOUSLY); // Play and repeat for a certain number of times int numberOfPlays = 3; clip.loop(numberOfPlays-1);

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.