So I'm writing a small tool to do Voice Recognition. I started just with SAPI 5.4 and used an SRGS xml file to set up my grammar. It worked very nicely. All my commands were recognized easily. However, I'm trying to get this thing to run on XP and I'm having trouble. I've used the following code to read in my existing xml file:
listener = New SpSharedRecoContext()
AddHandler listener.Recognition, AddressOf Handle_Speech
Dim grammar As ISpeechRecoGrammar
grammar = listener.CreateGrammar()
grammar.CmdLoadFromFile(Utilities.INI.ConfigPath & "\Voice_Commands.xml")
grammar.CmdSetRuleIdState(0, SpeechRuleState.SGDSActive)
However, the performance of SAPI 5.1 in recognizing commands is much-much worse than 5.4. First of all it starts an external listener app that you have to turn on (I guess this isn't too bad). But I think the main problem is that the listener will start doing OS operations when I speak (opening folders etc.); so its obviously listening for more than just my pre-defined set of commands.
Does anyone know how to make SAPI 5.1 perform like 5.4?
Thanks,
Ian
Are you sure this is XP? The behavior you're describing sounds like you're getting Windows Speech Recognition running, which only runs on Vista and above.
You need an in-proc recognizer (SpInProcRecoContext), instead of the shared recognizer. This needs a bit of work to initialize (you need to attach an engine & audio source). I wrote a bit on this on my blog, but I used the native APIs to do it.
Lastly, the SR engine on XP is indeed not as good as the SR engine in Vista and above. After all, the XP SR engine is over a decade old.
Related
I´m currently trying to make USB communication to the laser controler TLB 6700 (New Focus - Newport) with python.
https://www.newport.com/f/velocity-wide-&-fine-tunable-lasers
This is my first python task, and I´ve been having several troubles. So, by steps:
1) This device has its own drivers, and a comercial software to control it. However, I would like to develop my own code to perform several automation procedures.
2) The newport drivers are not NI compatible. This mean that I can not use PyVisa to recognise the device if I´m using the Newport drivers.
3) I think I can not use PyUSB too, for the same reasson. Even I´m not totally sure about that.
4) A solution that I´ve found is to use the NI-Interactive control to install a secondary NI driver for the device. Following this procedure I can recognise the device with PyUSB.
5) However, I do not understand how to activate the device and to send commands. I guess that the correct procedure is something like:
5.1: Call a library. Newport provides diferent libraries and dllwrapers. I´m asuming that the correct procedure is to use Ctypes to call the primary device dll. This will lead the possible instruction call.
5.2: Recognise the device as I´ve done with the NI driver and thorugh PyUSB.
5.3: Open the device and send command through PyUSB code.
So, here my questions:
PyVISA seems much easier to use than PyUSB. Any of you know a procedure to do the same but with PyVISA?
Any of you have done similar procedure with Newport devices, or even with the same TLB 6700 controller?
Thank you in advance,
Cheers,
It might be a bit late but just in case, I developed a python code to control a TLB 67xx. You could find it in my github.
Basically I call the dll through (UsbDllWrap) python net (import clr) and use it to set the wavelength, start a scan , etc... I do have several decorator that you could dismiss (#InOut.output for instance). You might need to adjust the path of your dll, if you do not use Anaconda for python. That is the only decent way I found to control the NewFocus laser, as it will not be possible to control them through PyVisa.
Obviously, doing so it is only possible on Windows.
I am still working on a cross platform solution that could be suitable for Linux
If I have an application that is written in .net Compact Framework (and runs on Windows CE) and is theoretically compatible with Windows Embedded Standard O/S, would it still be compatible if it makes use of OpenNETCF functionality?
Things like running .exe files with help of OpenNETCF for example. I am assuming that OpenNETCF uses P/Invoke under the hood, which might make the application incompatible with other OS than Windows CE.
I don't use P/Invoke in my code, but I can't asnwer for sure whether OpenNETCF does or does not.
.net compact framework 2.0 and windows embedded standard
OpenNETCF does use P/Invoke extensively.
It is effectively a wrapper for some core OS functionality in Windows CE and its derivatives, that is not otherwise implemented in the Compact Framework. In practice this means extensive P/Invoking of coredll.dll; the basic OS module for Windows CE.
Windows Embedded Standard is Windows XP. For this reason I would not expect you to be able to use OpenNETCF.
Depending on the version you're using you may be able to get hold of the OpenNETCF code here (or buy the latest of course), and see what's going on under the hood. Also, what you may find is that the calls you are making to the OpenNETCF are actually implemented anyway when compiling for Windows Embedded Standard.
One way to approach this is to make another project to target this platform, containing exactly the same code files, but no reference to the OpenNETCF, then work through fixing the compile errors.
You can add a Conditional compilation symbol to either the CE project or the Windows Embedded project then fix the errors like so (This example is not for OpenNETCF, but you get the idea):
public static string ExecutingAssembly
{
get
{
#if WindowsCE
return Assembly.GetExecutingAssembly().GetName().CodeBase;
#else
return Assembly.GetExecutingAssembly().Location;
#endif
}
}
Obviously you will then have to create a build for each platform as the outputted assemblies will now be different.
As Chris points out, the SDF makes heavy use of coredll P/Invokes. That's not to say everything does, but it's certainly a minefield. I tend to have a CF project and a FFX project and places where I have overlap I use aliasing, like this:
#if WindowsCE
using Thread = OpenNETCF.Threading.Thread2;
#else
using Thread = System.Threading.Thread;
#endif
Then in the code you just do your normal
var thread = new Thread(...);
And things work out.
Now ages ago we did start an interesting side project of creating a coredll "shim" for the desktop. What that means is that a p/invoke to "coredll" on the desktop would actually call that DLL, which would in turn marshal the calls off to kernel32, user32 or whatever. Our testing for what we implemented (and there's a fair bit there) showed that it worked just fine, so if you're using a limited subset of APIs, just dropping it on the PC might make the CF assembly "just work".
I have a Symbian 9.1 handset, Nokia E65, based on Nokia S60 series UI. I'd like to build a simple, full screen, graphic application. It should be able to display some text and pictures and have a basic interaction from the keyboard. That's for me only, not to be deployed.
Now, what do you think is the quickest and most painless way to have it done?
I have the following skills:
- HTML, PHP, ASP.net, JS
- ASP.net and C#, Silverlight
- Java, but mostly for networking, not UI
- Some C++
I have downloaded the Nokia IDE, but it is scary at first sight :)
Any tutorial or example are welcome!
Edit:
In particular, two questions:
is there a possibility to make a stand-alone flash application for that handset?
how about the QT mobile version?
For your device, definitely use Python for S60. It is much easier to start with than Symbian's C++ SDK and in case you ever need more low level functionality than python gives you, you can write small modules in c++ and use them in your Python program.
For a simple application like the one you are describing, Python will do just fine. You don't even need any of Nokia's IDEs / tools on the PC, you can just write the code in any text editor, copy it to the phone and test it live.
As others have mentioned, other options include:
Symbian C++ SDK : As you have discovered the tools and not the most intuitive to work with, development is not straight forward either.
Nokia's WRT : Using javascript/css/html, but it is not available for your phone.
Qt : Not available for your phone.
Java Me : Probably your second best option, your code will be slightly larger but more protable. The tools are not as straight forward as with Python, but definitely not as complicated as with Symbian.
If you think you may like to do some further development on the Symbian platform in future, I'd strongly suggest looking at Qt. Unfortunately, however, you can't use it on your E65, since Qt requires S60 3.1 or higher. (The E65 runs S60 3.0).
Since Qt coding in done in C++, you also have access to native platform APIs if required. For most apps however, the (considerably more user-friendly) Qt APIs provide all the functionality you need.
Depending on your background, the learning curve may be steeper than using Java or Python, but the pay-off is that you get access to a very powerful toolkit. And of course, as long as you use only Qt APIs, your app should be easily portable to other Qt platforms if necessary.
Go for Java ME.
All the things you list in your post is possible to do in Java.
The Symbian SDK for C++ can be downloaded here.
NSBasic is another option.
Kindness,
Dan
May I suggest Python? For newer Symbian handsets I'd recommend Web Runtime (WRT), but it is not supported on good old E65.
I'm obviously biased but I would suggest getting the 2D graphics example code from the "Quick Recipes On Symbian OS" book:
If you know HTML and JS already, you should be able to write a Web widget for your Symbian device pretty easily, using the tools available through Forum Nokia. More info here:
http://www.forum.nokia.com/Technology_Topics/Web_Technologies/Web_Runtime/
These widgets are standalone full screen applications that use the device WebKit browser engine for rendering and UI. You can also use keyboard inputs and customize the softkeys if you wish.
I want to have an action performed whenever the user (while using Vista voice recognition) says "Wingbats are crazy!". How do I do this? Is there scripting or is there a dll to tie into?
You might want to check out the Microsoft Speech API (SAPI). I used this in Windows XP a while ago and it supports an XML markup that declares the command(s) that you want the system to recognise. Your application then determines what needs to happen when a speech command is recognised.
For speech recognition, check out the ISpRecoContext interface.
Previously this was a COM interface, but since Vista you can use .NET. Or apparently you can use Python if that's your preference!
Edit
Microsoft Speech Server 2007 supports VoiceXML, mentioned in another response to this question.
I would recommend the WSR Macro toolkit. It lets you easily integrate your custom scripts into the Windows Speech Recognition system. SAPI and System.Speech.Recognition are great if you need more control, but given your question, I suspect that the learning curve will be much easier with WSR Macros.
Check out Voice XML. A list of systems implementing the standard can be found on w3.org.
I have the following requirements:
I need a api that works on CE (x86) + .NET Compact Framework to play videos (Similar to CorePlayer API... Just free)?
Is their anything else available or must I use CorePlayer?
You could use the MediaPlayer with COM interop. Have a look at this and this.
Also, Media Player may not be installed in your device.
You need to use DShow and have the codecs for whatever media you intend to play in the image. COM interop for WMP 9.0 (which is what ships up through at least CE 5.0, maybe also in 6.0) is a non-starter for managed code.
If you don't know DShow, it's a fair amount of work - even in native code - as DShow is not a fun or friendly API set.
The plus side is that you don't need WMP at all in the image, so you can typically use a Core CE license (Pro is required to use WMP). I know of a commercial DShow control, but you said you're looking for a free solution and I'm not aware of anything other than rolling your own. Depending on your level of familiarity with COM interop (which you'll need for the DShow stuff) and the use of DShow and filtergraphs, I'd allocate at least a week or two to getting this working.
One added note - the complexity also changes depending on how you want the video displayed. If it's just full-screen then it's a bit less work than getting it inside a Window within your app. Not a lot less, but at least a little.
DirectShow?
Check out this page for a starting point.
Provided that DirectShow is present on your CE, which I don't know...
EDIT: Since you can use DirectShow, I'd like to add a bit.
As ctacke notes, it can be a lot of work if you do everything manually, but it's pretty straightforward if you can use IGraphBuilder (see the sample I linked above).
I don't know much about DirectShow versions, but the one included with Windows Mobile 6.0 lacks a splitter for MPEG audio. It means, e.g., that out of the box it won't play .mp3 files unless you wrap them in RIFF headers.
I bet you can convert some of DirectShow.Net to run on CE if you are looking for a C# solution.