API Java Sound - capturando microfone
Estou lendo a API de som para Java há alguns dias. Não consigo entender isso. Sou um programador decente, só estou tendo dificuldades em entender a API.
Eu tenho tentado capturar áudio do meu microfone e exibir um gráfico de ondas em tempo real.
Estou tendo problemas para capturar áudio, dizem eles no tutorial, mas não consigo fazê-lo funcionar.
Qualquer sugestão e ajuda seria muito apreciada, uma resposta linha por linha seria o ideal.
Por favor e obrigado.
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.TargetDataLine;
public class FindLine {
public static void main (String[] args){
AudioFormat format = new AudioFormat(22000,16,2,true,true);
TargetDataLine line;
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
format); // format is an AudioFormat object
if (!AudioSystem.isLineSupported(info)) {
// Handle the error ...
}
// Obtain and open the line.
try {
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
} catch (LineUnavailableException ex) {
// Handle the error ...
}
}
}