Library for using speech to text in Lua offline. Using PocketSphinx and SphinxBase.
Please install pocketsphinx and sphinxbase first.
Then, install Lua5.1. The following commands is for Ubuntu and Debian User.
$ sudo apt-get install lua5.1 liblua5.1-dev
Clone, compile, and then install this.
$ git clone https://github.com/stuarch/speechtotxt-lua.git
$ cd speechtotxt-lua
$ make
$ sudo make install
From file
speechtotxt = require("speechtotxt")
--first argument is for -hmm, second is for -lm, the last is for --dict.
--left it nil for default.
speech = speechtotxt.init(nil,nil,nil)
--get the speechtotxt result
--Address of sound file as argument
txt = speech:infile("./test.wav")
print(txt)
--close context
speech:close()
From Microphine
speechtotxt = require("speechtotxt")
--first argument is for -hmm, second is for -lm, the last is for --dict.
--left it nil for default.
speech = speechtotxt.init(nil,nil,nil)
--get the speechtotxt result
--it will wait for speak
txt = speech:inmic()
print(txt)
--close context
speech:close()