I am using Java Sound API to record audio through a microphone. But why am I getting false
as an output for the below snippet of code?
AudioFormat getAudioFormat() {
float sampleRate = 8000;
int sampleSizeInBits = 16;
int channels = 1; //1 for mono, 2 for stereo
boolean signed = true;
boolean bigEndian = true;
AudioFormat format = new AudioFormat(sampleRate, sampleSizeInBits,
channels, signed, bigEndian);
return format;
}
void myTest() {
AudioFormat format = getAudioFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
System.out.println(AudioSystem.isLineSupported(info));
}
public static void main(String[] args) {
new JavaApplication20().myTest();
}
Thanks in advance.