Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

java - javax.sound.sampled.LineUnavailableException : Why am I getting this exception?

When the following method is executed:

private void beep_player_1() {
    try {
        //clip_Player_2.close();
        clip_Player_1 = AudioSystem.getClip();
        ais = AudioSystem.getAudioInputStream(new File(Constants.Player1_Default_Tone)); // PATH FOR THE .WAV FILE
        clip_Player_1.open(ais);
        clip_Player_1.loop(0); // PLAY ONCE
    }catch(Exception exc) {
        System.out.println(exc);
     }
}

LineUnavailableException get thrown. What could be the reason for this?

javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian not supported.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What could be the reason for this ?

javax.sound.sampled.LineUnavailableException: line with format 
  PCM_SIGNED 44100.0 Hz, 
  24 bit, 
  stereo, 
  6 bytes/frame, 
  little-endian not supported.

I don't know about the rest, but most PCs I've encountered use 8 or 16 bit 'bit depth' while that uses 24 bits. It indicates a very finely nuanced recording quality. If 8 bit is 'phone quality' and 16 bit is 'CD quality', then 24 bit would be 'master recording quality'.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...