Package edu.cmu.pocketsphinx

Examples of edu.cmu.pocketsphinx.Config


        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) {
View Full Code Here

TOP

Related Classes of edu.cmu.pocketsphinx.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.