0
votes

I tried LatticeDemo.java. And, I could get the result as shown in the example result. This example is using "AudioFileDataSource" for voice data (10001-90210-01803.wav). I am trying to recognize this voice data in a different way using StreamDataSource.

But, I get a different result. I would like to hear any idea.

The following is the steps I took:

  1. get Byte data from 10001-90210-01803.wav by the following code

    File f = new File(file);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BufferedInputStream in;
            try {
                in = new BufferedInputStream(new FileInputStream(f));
    
                return ByteStreams.toByteArray(in);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
  2. Then, just put this byte data called "data" into ByteArrayInputStream like the following

    StreamDataSource dataSource = (StreamDataSource) cm.lookup("streamDataSource"); ByteArrayInputStream st = new ByteArrayInputStream(data); dataSource.setInputStream(st, "Main Stream");

Actually, when we use "setInputStream" function, the second argument(i.e. "Main Stream") has special meaning? I cannot see why this argument is needed.

The configuration for streamDataSource is the following:

<component name="streamDataSource" type="edu.cmu.sphinx.frontend.util.StreamDataSource"> <property name="sampleRate" value="16000" /> <property name="bigendianData" value="false" /> </component>

The output is

Loading...
17:48:01.941 WARNING dictionary        Missing word: <unk>
17:48:02.543 WARNING dictionary        Missing word: <unk>
 <s> i. </s>
 <s> i. <sil> </s>
 <s> i. a. </s>
 <s> i. a </s>
 <s> i </s>
 <s> i a </s>
 <s> i <sil> </s>
 <s> i a. </s>
 <s> high a </s>
 <s> i </s>
 <s> a i </s>
 <s> a i. </s>
 <s> i i </s>
 <s> i i. </s>
 <s> i. </s>
 <s> i. i. </s>
 <s> high </s>
 <s> higher </s>
 <s> tight </s>
 <s> right </s>
 <s> wright </s>
I heard: i

Regards

1

1 Answers

0
votes

Actually, when we use "setInputStream" function, the second argument(i.e. "Main Stream") has special meaning? I cannot see why this argument is needed.

No, this argument is unused and kept for compatibility

 <property name="bigendianData" value="false" /> 

Property name is bigEndianData, not bigendianData. Please also make sure you are using latest sphinx4, it's actually recommended to checkout a latest trunk from subversion.