import java.io.File; import java.util.Scanner; class DataManage{ public static void main(String[] args){ MusicControl musicControler; File clip; Scanner scan = new Scanner(System.in); int data; while(true){ data = scan.nextInt(); clip = new File(new StringBuffer().append("LaunchPad/music/").append(data).append(".wav").toString()); musicControler = new MusicControl(clip); musicControler.start(); } } } import java.io.File; import javax.sound.sampled.*; class MusicControl extends Thread{ private Clip clip; private File sound; private FloatControl volume; public MusicControl(File sound){ this.sound = sound; musicSetup(); } public void run(){ try{ clip.start(); Thread.sleep(clip.getMicrosecondLength()/1000); }catch(Exception e){ System.out.println(e); } } public void musicSetup(){ try{ clip = AudioSystem.getClip(); clip.open(AudioSystem.getAudioInputStream(sound)); }catch(Exception e){ System.out.println(e); } } } I'm trying to play a sound in my Raspberry pi2. This program works really well in Window7. However, it works strange in the Raspberry pi2. When I start the program, it works well until it counts 8. If it plays more than 8 times, it prints
javax.sound.sampled.LineUnavailaleException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported. How can I fix it? Please give me a hand.