Reputation: 81
I would like to use Sphinx4 for a part of my system. And, I have already tried the HelloWorld demo which uses the microphone directly. Also, I have seen examples about using audio files.
So, my question is that is whether there is any other way to recognize voice? For example, recognize short type data (e.g. a short[]
buffer).
I cannot find ways other than using the microphone or wav files (audio files).
For example, PocketSphinx has the processRaw
function which is described in this question (Input for Pocketsphinx on Android).
Is there no corresponding function in Sphinx4?
Upvotes: 2
Views: 779
Reputation: 25220
To feed data from a byte array you need to do the following:
Configure frontend to use StreamDataSource instead of Microphone or AudioFileDataSource. You can see LatticeDemo or TranscriberDemo for example how to do that.
Create ByteArrayInputStream from byte[] array with data
Set input stream to use ByteArrayInputStream with setInputStream method of StreamDataSource
Run recognize() to recognize data from byte array
You can succesfully use any data through InputStream, for example input data from a Socket or from a File.
Upvotes: 1