Java capture audio with pulseaudio
-
28-04-2021 - |
Question
i'm trying to capture/play audio with java in linux with pulseaudio server.
there's no problem with playing. i can open capture device (microphone) but when calling micro.available returns 0 forever.
any tip ?
audioFormat = new AudioFormat(44100, 16, 2, true, false);
targetInfo = new DataLine.Info(TargetDataLine.class, audioFormat);
sourceInfo = new DataLine.Info(SourceDataLine.class, audioFormat);
targetDataLine = (TargetDataLine) AudioSystem.getTargetDataLine(audioFormat);
targetDataLine.open();
targetDataLine.start();
sourceDataLine = (SourceDataLine) AudioSystem.getLine(sourceInfo);
sourceDataLine.open(audioFormat);
La solution
The problem is in the sun jdk. With openjdk it works.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow