System.loadLibrary("pocketsphinx_jni");
}
@Test
public void testDecodeRaw() {
Config c = Decoder.defaultConfig();
c.setFloat("-samprate", 8000);
c.setString("-hmm", "../../model/hmm/en_US/hub4wsj_sc_8k");
c.setString("-lm", "../../model/lm/en_US/hub4.5000.DMP");
c.setString("-dict", "../../model/lm/en_US/hub4.5000.dic");
Decoder d = new Decoder(c);
AudioInputStream ais = null;
try {
URL testwav = new URL("file:../../test/data/wsj/n800_440c0207.wav");
AudioInputStream tmp = AudioSystem.getAudioInputStream(testwav);
// Convert it to the desired audio format for PocketSphinx.
AudioFormat targetAudioFormat =
new AudioFormat((float)c.getFloat("-samprate"),
16, 1, true, true);
ais = AudioSystem.getAudioInputStream(targetAudioFormat, tmp);
} catch (IOException e) {
fail("Failed to open " + e.getMessage());
} catch (UnsupportedAudioFileException e) {