Anonymous - 2008-12-01

Hi,

I can compile, run, and record sound files using both Audacity and the following Java program (under Kubuntu Linux):

http://www.jsresources.org/examples/SimpleAudioRecorder.java.html

It instantiates AudioFormat as (encoding, sampleRate, sampleSize, channels, frameSize, frameRate, bigEndian):

AudioFormat.Encoding.PCM_SIGNED,
16000.0F,
16,
2,
4,
16000.0F,
true

I have updated spectrogram.config.xml to match these settings:

<property name="channels" value="2"/>
<property name="sampleRate" value="16000"/>
<property name="bitsPerSample" value="16"/>
<property name="bigEndian" value="true"/>
<property name="signed" value="true"/>
<property name="selectMixer" value="default"/>

I have manually run the AudioTool as follows:

$ java -cp ../lib/sphinx4.jar:. edu.cmu.sphinx.tools.audio.AudioTool

Using Audacity, the Recording Device is set to HDA Intel (hw:0.0).

The AudioTool program can play files created by SimpleAudioRecorder.

When I record using AudioTool, nothing is audible unless I yell (and even then, it is crackly and faint). It is almost as though the AudioTool is trying to record from Line-in instead of from Mic.

I've tried changing the selectMixer option, as well, to coincide with the -dumpMixers output. I noticed that Mixer[2] seems to be missing TargetLineInfo. However, since I'm not using Mixer[2], that doesn't strike me as the issue. From -dumpMixers:

Mixer[2]: "Java Sound Audio Engine"
Description: Software mixer and synthesizer
SourceLineInfo (e.g., speakers):
PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
TargetLineInfo (e.g., microphones):
none
Mixer[3]: "Port Intel [hw:0]"

Here is the debug output from AudioTool:

$ java -cp ../lib/sphinx4.jar:. edu.cmu.sphinx.tools.audio.AudioTool
01:22.923 INFO microphone Desired format: PCM_SIGNED 16000.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian supported.
01:22.887 INFO microphone Final format: PCM_SIGNED 16000.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian
01:22.891 INFO microphone open
01:22.897 INFO microphone line listener Open event from line com.sun.media.sound.DirectAudioDevice$DirectTDL@52c00025
01:22.898 INFO microphone Frame size: 320 bytes
01:22.900 INFO microphone started recording
01:22.900 INFO microphone DataStartSignal added
01:22.901 INFO microphone line listener Start event from line com.sun.media.sound.DirectAudioDevice$DirectTDL@52c00025
01:22.333 INFO microphone line listener Stop event from line com.sun.media.sound.DirectAudioDevice$DirectTDL@52c00025
01:22.334 INFO microphone line listener Close event from line com.sun.media.sound.DirectAudioDevice$DirectTDL@52c00025
01:22.347 INFO microphone DataEndSignal ended
01:22.348 INFO microphone stopped recording

Anyone have any advice in how to further debug the issue? I can see no reason why one Java tool can record audio while the other cannot.

I have even gone so far as to hard-code the same line of code between AudioTool and SimpleAudioRecorder so that they are using the exact same instantiation parameters of AudioFormat.

The problem is elsewhere.

Any ideas?

Thanks!