PulseAudio capture issue
August Sodora
augsod at gmail.com
Mon Jul 5 13:46:49 PDT 2010
Hello all,
I've been attempting to write a simple program to capture audio from the
microphone and found a piece of sample code that seemed to demonstrate the
basic idea but also possibly indicates a bug in the openjdk implementation
of the pulse interface. Running the example with java-6-openjdk produces an
exception when the TargetDataLine is closed but it runs successfully with
java-6-sun. The exception is reproduced below:
java.lang.IllegalStateException: Line cant be closed if it isnt open
at
org.classpath.icedtea.pulseaudio.PulseAudioTargetDataLine.close(PulseAudioTargetDataLine.java:84)
at
javax.sound.sampled.AudioInputStream$TargetDataLineInputStream.close(AudioInputStream.java:484)
at javax.sound.sampled.AudioInputStream.close(AudioInputStream.java:389)
at java.io.SequenceInputStream.nextStream(SequenceInputStream.java:106)
at java.io.SequenceInputStream.read(SequenceInputStream.java:210)
at java.io.SequenceInputStream.read(SequenceInputStream.java:211)
at java.io.InputStream.read(InputStream.java:102)
at
com.sun.media.sound.WaveFileWriter.writeWaveFile(WaveFileWriter.java:249)
at com.sun.media.sound.WaveFileWriter.write(WaveFileWriter.java:147)
at javax.sound.sampled.AudioSystem.write(AudioSystem.java:1354)
at AudioRecorder02$CaptureThread.run(AudioRecorder02.java:221)
And the example source can be found at
http://www.developer.com/java/other/article.php/2105421/Java-Sound-Capturing-Microphone-Data-into-an-Audio-File.htm#Complete
Program Listings
<http://www.developer.com/java/other/article.php/2105421/Java-Sound-Capturing-Microphone-Data-into-an-Audio-File.htm#Complete
Program Listings>
uname -a
Linux ubuntu 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010
x86_64 GNU/Linux
Steps to reproduce:
1. Copy the program listing into a file name AudioRecorder02.java
2. javac AudioRecorder02.java
3. sudo update-java-alternatives -s java-6-openjdk
4. java AudioRecorder02
5. Select "Capture" followed by "Stop"
6. The above exception will be produced
If in step 3, one replaces java-6-openjdk with java-6-sun, the program runs
successfully.
I'd be interested in investigating this further if that would be useful.
Augie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/jdk6-dev/attachments/20100705/2dba89c6/attachment.html
More information about the jdk6-dev
mailing list