HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
They all seem to work on my Win10 64 bit with AHK 1.1.28.02 U64 Demo works. I will have to play around with it later.
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Thanks, gregster. I bet it's me running Win7. I found this article on speech recognition, by the way.
EDIT: I downloaded the MS Speech SDK 11.0 and compiled HotVoice.0.1.0 (VS2017). It compiled fine, but the test app crashed, throwing a System.Runtime.InteropServices.COM unhandled exception.
Class ID (hope I'm copying it correctly): CLSID {49428A60-C997-4D0E-9808-9E32C178D58}, error 80040154 (Class not registered). I'm going to restart, try regasm on the assembly.
Regards,
burque505
EDIT: I downloaded the MS Speech SDK 11.0 and compiled HotVoice.0.1.0 (VS2017). It compiled fine, but the test app crashed, throwing a System.Runtime.InteropServices.COM unhandled exception.
Class ID (hope I'm copying it correctly): CLSID {49428A60-C997-4D0E-9808-9E32C178D58}, error 80040154 (Class not registered). I'm going to restart, try regasm on the assembly.
Regards,
burque505
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Yeah, I dunno if Win7 is supported or not.
Thanks for the link to the article, it may help to link it for people as it explains what Grammars and Choices are quite well.
FYI, In HotVoice, the "GrammarObject" (The HotGrammar class that you get when you do hv.NewGrammar()) is a wrapper around the GrammarBuilder class.
The Choices class in HotVoice is not wrapped. When you do hv.NewChoices(), you get an actual Choices class back.
There is no user-exposed Grammar object in HotVoice, seeing as we need to convert the GrammarBuilder into a Grammar to load it and there doesn't seem to be any point in having access to the Grammar class that got uploaded.
Thanks for the link to the article, it may help to link it for people as it explains what Grammars and Choices are quite well.
FYI, In HotVoice, the "GrammarObject" (The HotGrammar class that you get when you do hv.NewGrammar()) is a wrapper around the GrammarBuilder class.
The Choices class in HotVoice is not wrapped. When you do hv.NewChoices(), you get an actual Choices class back.
There is no user-exposed Grammar object in HotVoice, seeing as we need to convert the GrammarBuilder into a Grammar to load it and there doesn't seem to be any point in having access to the Grammar class that got uploaded.
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
This is going to be an awesome script to try... Thank you so much for making it.... I've dabbled in voice recognition before and found file commands have been super fast.
I'm trying to locate hotvoice.dll -- it didn't seem to download / install with any packages as per the install instructions. Could someone please help me figure out where it's gone / where to find it?
Many thanks
R
I'm trying to locate hotvoice.dll -- it didn't seem to download / install with any packages as per the install instructions. Could someone please help me figure out where it's gone / where to find it?
Many thanks
R
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
It is included in the packages from the release branch: https://github.com/evilC/HotVoice/releases - just tested, I found the dll in the Lib folder of Hotvoice.zipr2997790 wrote:I'm trying to locate hotvoice.dll -- it didn't seem to download / install with any packages as per the install instructions. Could someone please help me figure out where it's gone / where to find it?
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Thanks @gregster @evil ... I downloaded the source zip I think and it wasn't there but just downloaded the Hotvoice.zip file on the Releases and all is good
Many thanks for your help... can't wait to try it out now!
Many thanks for your help... can't wait to try it out now!
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Seems like the DLL issue has been resolved (and by installing the 64Bit version of the Speech engine).
But now I am getting this issue:
A language issue despite downloading a ton of the .msi language files.
Frustrating... anyone else had this issue and know how to fix it?
Many thanks.
But now I am getting this issue:
A language issue despite downloading a ton of the .msi language files.
Frustrating... anyone else had this issue and know how to fix it?
Many thanks.
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
With the 0.1.0 version I also get this error message, if I set the recognizer id to 1 (which would be the second language I installed).
Setting it to 2 ('lightweight' in this case) doesn't crash, but doesn't recognize anything (but that was expected).
With the older versions 0.0.3 and 0.0.4, setting the id to 1 doesn't create an error, but doesn't recognize anything either. The volume level doesn't even move.
All three versions seem to work only with the recognizer id set to 0, although two language packs are installed.
Perhaps there is something still hardcoded to 0 in the dll?
Btw, there seems to be a typo inBut that shouldn't cause the problem mentioned above...
Edit: There is another minor bug in Initialize(id) - the check for a valid id isn't working in all cases, because id is zero-based. I think this should fix it:
Setting it to 2 ('lightweight' in this case) doesn't crash, but doesn't recognize anything (but that was expected).
With the older versions 0.0.3 and 0.0.4, setting the id to 1 doesn't create an error, but doesn't recognize anything either. The volume level doesn't even move.
All three versions seem to work only with the recognizer id set to 0, although two language packs are installed.
Perhaps there is something still hardcoded to 0 in the dll?
Btw, there seems to be a typo in
Code: Select all
LoadGrammar(grammar, name, callback){
if (this._grammarCallbacks.HasKey(name)){ ; was: if (this._grammarCallbacks.HasKey(nanme)){
Edit: There is another minor bug in Initialize(id) - the check for a valid id isn't working in all cases, because id is zero-based. I think this should fix it:
Code: Select all
Initialize(id){
c := this.Instance.GetRecognizerCount() - 1
if (id > c){
MsgBox % "No Such ID " id
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
@r2997790 - Try removing all but one language pack?
@gregster Yeah, I suspect that only English works, as I tried installing French and Spanish, but could not get them to recognize anything I said.
It could just be that only recognizer 0 works, I dunno. If anyone could shed any light on it, that would be great.
Thanks for the Initialize fix - it was also outputting c, not id - duh!
@gregster Yeah, I suspect that only English works, as I tried installing French and Spanish, but could not get them to recognize anything I said.
It could just be that only recognizer 0 works, I dunno. If anyone could shed any light on it, that would be great.
Thanks for the Initialize fix - it was also outputting c, not id - duh!
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
@evilC, I think you have to have a CultureInfo object for each language. I found this code snippet in the article linked above.
Regards,
burque505
Code: Select all
CultureInfo ci = new CultureInfo("en-us");
sre = new SpeechRecognitionEngine(ci);
sre.SetInputToDefaultAudioDevice();
sre.SpeechRecognized += sre_SpeechRecognized;
burque505
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
ohhh, that sounds likely.
Can I work out what to pass for the CultureInfo from what the user selected for the language pack, I wonder?
I will look into this now
Can I work out what to pass for the CultureInfo from what the user selected for the language pack, I wonder?
I will look into this now
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Actually, it doesn't seem to be a question of language, but only of id.
I have german on id 0 and it understands it quite well. Even using the original english words - with (awful sounding) german pronunciation - worked... while english pronunciation didn't work then. Trying to use US english on id 1 would throw the error above.
But perhaps only the standard language of the specific windows installation works (by default?)...?!? I also use german as standard language for my windows installation. That might be connected to this CultureInfo object.
I have german on id 0 and it understands it quite well. Even using the original english words - with (awful sounding) german pronunciation - worked... while english pronunciation didn't work then. Trying to use US english on id 1 would throw the error above.
But perhaps only the standard language of the specific windows installation works (by default?)...?!? I also use german as standard language for my windows installation. That might be connected to this CultureInfo object.
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
OK, I think I got it.
Try the attached DLL (You may well need to unblock it)
Try the attached DLL (You may well need to unblock it)
- Attachments
-
- CultureFix.zip
- (4.81 KiB) Downloaded 113 times
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Meh, sod it, I have made a new release - if it breaks stuff I can always revert out. Seems pretty safe tho.
There are also a number of other fixes in there.
https://github.com/evilC/HotVoice/releases/tag/v0.1.1
There are also a number of other fixes in there.
https://github.com/evilC/HotVoice/releases/tag/v0.1.1
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Looks good so far. German on id 0, and US English on id 1 work here now.
Thanks a lot!
Thanks a lot!
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Wish I could test it
Still haven't gotten it to run on Win7.
EDIT: Downloaded the SpeechPlatform runtime from here and installed it.
Still throwing an error, but at least the DLL loads. I will uninstall and reinstall the SDK and post results.
EDIT: Reinstalled SDK, both it and runtime now 64-bit. Still get the CultureInfo.InvariantCulture error.
Error is this:
burque505
Still haven't gotten it to run on Win7.
EDIT: Downloaded the SpeechPlatform runtime from here and installed it.
Still throwing an error, but at least the DLL loads. I will uninstall and reinstall the SDK and post results.
EDIT: Reinstalled SDK, both it and runtime now 64-bit. Still get the CultureInfo.InvariantCulture error.
Error is this:
Spoiler
Reinstalled English and German due to 'CultureInfo.InvariantCulture' error, now getting this error:
Spoiler
Regards,burque505
Last edited by burque505 on 02 Jun 2018, 11:25, edited 1 time in total.
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
It seems like the language pack you have is of type CultureInfo.InvariantCulture ?
I was following the advice here - https://stackoverflow.com/questions/246 ... -recognize
So basically I take the culture from the language pack and pass it to the constructor of the recognizer
I was following the advice here - https://stackoverflow.com/questions/246 ... -recognize
So basically I take the culture from the language pack and pass it to the constructor of the recognizer
Code: Select all
public HotVoice()
{
_recognizers = SpeechRecognitionEngine.InstalledRecognizers().ToList();
var percentileChoices = new Choices();
for (var i = 0; i <= 100; i++)
percentileChoices.Add(i.ToString());
_choicesDictionary.Add("Percent", percentileChoices);
}
public void Initialize(int recognizerId = 0)
{
AssertRecognizerExists(recognizerId);
_recognizer = new SpeechRecognitionEngine(new CultureInfo(_recognizers[recognizerId].Culture.Name));
// Add a handler for the speech recognized event.
_recognizer.SpeechRecognized += Recognizer_SpeechRecognized;
// Configure the input to the speech recognizer.
_recognizer.SetInputToDefaultAudioDevice();
}
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
Oh duh, surely I should have used this?
_recognizer = new SpeechRecognitionEngine(_recognizers[recognizerId].Culture);
DLL attached that does this
_recognizer = new SpeechRecognitionEngine(_recognizers[recognizerId].Culture);
DLL attached that does this
- Attachments
-
- CultureOptimize.zip
- (4.79 KiB) Downloaded 99 times
Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)
BTW I am sat in the AHK Discord channel - it's probably a lot easier to exchange files etc in there, and it supports screen-share etc...
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 215 guests