How to setup cmusphinx with lua? - lua

So I wanted to go about designing an add-on for a game I play, World of Warcraft and the game uses Lua scripts. The add-on involves speech recognition. I found a library that apparently adds voice recognition functionality to Lua.
Here is the link to the library: https://github.com/stuarch/speechtotxt-lua
The problem is, I have no idea how to set this up. It looks like they're using linux commands, but can I use this with Windows?
Also, do I have to put all these files in a certain place (pocketsphinx, sphinxbase) like a project folder, and then call them from Lua?
I'm sorry if this a noob question, I just can't find anything online about adding these libraries to Lua, and how to include the pocketsphinx and sphinx base. Any help would be greatly appreciated.

There is a difference between let's say running the full Lua interpreter under Windows and running a Lua interpreter as part of a software like WoW.
They usually restrict the use of Lua to what makes sense for the game. You don't have to reboot the system from within WoW, you also should not be able to manipulate files or even manipulate memory ....
Just imagine you install a WoW addon from the internet and it suddenly deletes all files on your computer. Whooops.
So they simply remove the standard Lua libraries like os, debug, io...
Of course they also don't want you to extend your power beyond those limitations by loading third party code. Hence they remove the require function.
So all you can do in WoW is run restricted Lua code and use the feature set they offer you.
Adding speach recognition to WoW is not possible through the embedded Lua interpreter.

Related

Codename One (or ParparVM) how to compile Java library into iOS library

By checking the Codename One website and ParparVM Github, its guide only show how to build the Java (with Java Main function entry point) into the native executable/app (iOS), but I can't find any guide to build/compile Java into iOS share library (either in C source or binary, as long as can be reused by swift/objective-C from iOS app).
So are we able to do so? is there any guide for that?
It wasn't designed for that purpose so it probably won't work well for it. There are some inherent design decisions that would make it very difficult to get ParparVM to work with a library. Two big ones:
The GC needs to work with roots and would have a hard time collecting without full control of the app
The code generated looks "awful". Method names translate to very long function names in C with a very convoluted syntax to allow all sort of VM edge cases such as covariance
I suggest you look at J2ObjC. I haven't checked it out in ages but it was designed exactly with this use case in mind. It doesn't have a "real" GC but that might be OK with ARC. It works with your sources and produces libraries that look a bit more "natural" on iOS.

Timer in Lua without using OS module?

I would like to implement a timer in Lua without using the os library.
I am working on a mod for a game I play, whose game scripts are written in Lua. I would like to implement a timer function, but for security reasons the game does not allow access to the os library and its time function. Is there still a way, or should I give up?
EDIT: The game's scripting engine is Halley, a lightweight engine written in C++. It appears to be a custom engine built by the developers of the game. https://github.com/amzeratul/halley
EDIT 2: This mod is intended for online multiplayer, so it has to work with the base game Lua scripts, and that means I can't use third party libraries or the OS library (trying to require it will throw an error). After much consideration I have come to believe that it is sadly not possible. Thanks to everyone who gave me comments.

How to prevent command key's default OS behavior using Love2d (LÖVE) or Lua

Is there a way to prevent the default OS behavior for a command key (i.e. prevent start menu opening and focus loss when the windows key is pressed) using Love2d (LÖVE) in particular, or Lua more generally. If I understand correctly, LÖVE uses LuaJIT, so it would be helpful if a Lua based approach did not involve Lua 5.2/5.3 functions that are not implemented in LuaJIT, but I could rebuild with the appropriate module or shim the LÖVE interpreter if necessary.
Having failed to find a simple solution on my own, I'm currently thinking I will have to create a Lua-C Module. If that is the case, any advice/links along those lines would be greatly appreciated. Thanks!
Lua certainly has no functionality for hijacking OS key functionality of this kind. Such things are too OS-specific for Lua to expose. And from its documentation, Love2D has no such functionality either.
While we're on the subject:
prevent start menu opening and focus loss when the windows key is pressed
It would be exceedingly rude to have your application prevent basic OS functionality like this from working. However good your game may be, it is not as important as the user being able to do what they actually want. If the user wants to switch to something else, that's their right, and you should not interfere. If the user accidentally pressed that button, that's their responsibility.
The only thing you should do is set up a love.focus callback, so that when the application loses focus you can automatically pause.

how do we display an image/color in lua

I am having this problem, and I am not able to figure out the solution.
I wish to display an image in some window if possible(not necessary tough), and then move it across the page by sending events from keyboard.
The problem is I can't use LÖVE framework, as we can't integrate it into our setup.
So I would require the Lua api's to do so.
Is anyone here aware about it? Also do I have to install some kind of extra library to support color and image operations?
Thanks for sharing the knowledge.
Lua is quite a bare-bones language to start with, so there is no built in image support whatsoever. But this also goes for almost all other programing languages, image support is typically something contained in supplementary libraries.
You need to install some library providing GUI functionality (like IUP), or use an application integrating Lua with graphical libraries (like murgaLua, Löve, ...)
From the tags you attached to your question it seems that you're using an embedded platform. It might be useful for people to know which, in order to provide more useful answers.

OpenCV porting for ARM9

I'm new to embedded software, I want to build a Image processing application for my AT91SAM9261-EK development board by Atmel. To make it simple i want to use the OpenCV functions, but i'm not sure how am I going to generate a .bim file for flashing on the brd.
Also can anyone you help me understand the flow / software structure for these kind of applications?
Like, will I need Linux or any other OS, if so where does the actual image processing code which i intend to write using opencv sit ?
Till now for simple codes like Basic LCD project, for this board i'm compiling the code using IAR workbench, so if I want to use the same for opencv functions, is there a way ?
Is there any other open source image processing libraries similar to opencv & easy to integrate with IAR or any other ARM compiler ?
Also it would be really useful if there are any links to some learning documents regarding this
Thanks in advance ?
Depending on your application, I think that CPU is not going to be powerful enough to do any kind of image processing; plus the weirdness of working with a foreign system is not going to make your life any easier.
If using this exact CPU is not super important I'd recommend a Beagleboard or Pandaboard, mainly because Ubuntu has installers targeted to the boards and Ubuntu/Debian offers OpenCV packages out of the box, and this is going to remove a whole lot of hurdles if you're new to embedded development -- basically it turns your dev board into a full-featured computer, just plug in a monitor, keyboard and mouse.
The Raspberry Pi looks to be promising in this regard as well, and you certainly can't argue with the price! (You may be able to install Debian on your board and get access to OpenCV packages this way, but I can't vouch for the ease-of-use of this method compared to Ubuntu, which is difficult enough, especially if you're new to Linux).

Resources