Пытаюсь записывать звук с микрофона, но вылазит ошибка. Подскажите в чем проблема ?
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 16000.0 Hz, 8 bit, stereo, 2 bytes/frame, not supported.
try {
AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;
TargetDataLine line;
AudioFormat format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED, 44100, 16, 1, 2, 44100, true);
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
if (!AudioSystem.isLineSupported(info)){
System.out.println("Line not supported !");
System.exit(1);
}
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
line.start();
AudioInputStream in = new AudioInputStream(line);
AudioSystem.write(in, fileType, file);
} catch (IOException | LineUnavailableException e){
e.printStackTrace();
}