HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

Post your working scripts, libraries and tools
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

10 Jul 2017, 17:16

This library allows you to use your voice as if it were a hotkey.

The below code makes the word "Test" trigger the function MyFunc()

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Documentation / Download
Last edited by evilC on 27 May 2018, 13:35, edited 6 times in total.
Ridwan
Posts: 18
Joined: 17 Oct 2015, 21:06

Re: [POC] HotVoice - Speech Recognitionn + Volume detection for AHK (C# DLL)

15 Jul 2017, 19:07

Nice..,
Can i use it for dictating?
scriptor2016
Posts: 356
Joined: 21 Dec 2015, 02:34

Re: [POC] HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

21 Jul 2017, 00:15

this looks REALLY useful. But it throws me an error message:





Error: 0x80131604 -
Source: mscorlib
Description: Exception has been thrown by the target of an invocation.
HelpFile: (null)
HelpContext: 0

Specifically: CreateInstance

Line#
145: Return,compilerRes[FileName="" ? "CompiledAssembly" : "PathToAssembly"]
146: }
149: {
150: VarSetCapacity(GUID, 16, 0)
151: Return,DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : ""
152: }
007: asm := CLR_LoadLibrary("HotVoice.dll")
---> 008: hv := asm.CreateInstance("HotVoice")
010: Gui,Add,Text,Center ww00,Volume
011: Gui,Add,Slider,xm w300 hwndhSlider
012: Gui,Show,,HotVoice
015: hv.SubscribeWord("Fire", Func("Fire"))
016: hv.SubscribeVolume(Func("AxisEvent"))
018: {
019: ToolTip,"Fire @ " A_TickCount

Continue running the script?
User avatar
BGM
Posts: 416
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: [POC] HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

21 Jul 2017, 08:47

This is very interesting to me and I will be keeping a watch on this topic!
Froggy85
Posts: 1
Joined: 31 Mar 2017, 15:45

Re: [POC] HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

02 Mar 2018, 14:03

I would also be interested. Please make it as simple as possible.
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: [POC] HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

24 May 2018, 18:43

I did some more work on this tonight, and thanks to Cap'n Odin for helping test

Improved logging and stuff, better demo

It seems that all you need to install is the x86 / x64 (Match to what version of AHK you have installed, or just install both) Runtime
Plus one language pack (eg MSSpeech_SR_en-US_TELE.msi)
Attachments
Source 0.0.2.zip
(1.43 MiB) Downloaded 8 times
Demo 0.0.2.zip
(231.7 KiB) Downloaded 8 times
User avatar
gregster
Posts: 1176
Joined: 30 Sep 2013, 06:48

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

26 May 2018, 02:43

Cool. Could be useful. Thanks a lot!
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

26 May 2018, 13:20

v0.0.4 released with new "Choices" POC
https://github.com/evilC/HotVoice/releases/tag/v0.0.4

Demo: "Choices Example.ahk"

1) Window Manipulation example
Verbs: Launch, Close, Minimize, Maximize, Restore
Choices: Notepad, DosBox
Example: "Launch Notepad".

2) Volume control example
Verbs: Volume
Choices: Any number from 0-100
Example: "Volume 55"
SpecialGuest
Posts: 16
Joined: 15 May 2016, 07:49

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

26 May 2018, 18:55

Thanks for sharing this. Pretty fun to play around with and useful as well.
I did notice that the last version makes two-worded triggers throw an error (due to the choices I guess) :


Is there any way to use both ?
.SubscribeWord with two-worded commands and .SubscribeWordWithChoiceList

Cheers
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

26 May 2018, 20:01

Been working on a new GrammarVars branch - I am thinking of moving over to this way of doing things.

You can build up grammar like so:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Image

I have not made a release, but I have attached a zip that contains this new version.

Have a play and see what you think.
Attachments
HotVoice.zip
GrammarVars POC
(233.2 KiB) Downloaded 4 times
Last edited by evilC on 26 May 2018, 20:08, edited 1 time in total.
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

26 May 2018, 20:06

@SpecialGuest if you put a hyphen between two-words, it seems to count as one ;)
I have learned a ton since I did the first version, what I am working on now does not suffer from the same problem.
The whole project is in a high state of flux at the moment, trying to work out how to provide max flexibility but also not force too much complexity on the user - not sure how long those old methods will last and if it is worth going back and fixing them...
SpecialGuest
Posts: 16
Joined: 15 May 2016, 07:49

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

27 May 2018, 08:00

A hyphen works indeed 8-) Thanks and keep up the good work. It looks promising.
I'll be sure to test that new version too later on as well but first I'm trying a few things with the "old" version.
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

27 May 2018, 08:41

Tinkering around today, I think I have hit upon a solution which is simpler - that whole "GrammarVar" system just did not quite gel for me.
Unfortunately, COM does not seem to support variable number of parameters in a function call, but I am experimenting with the idea of 10 parameter functions with optional parameters as a work-around.
This allows you to work in AHK with objects, build them up using AHK variables, and then load the finished result into the recognizer.
I am not sure you are gonna be wanting to add more than 10 grammar branches in a node, and we can always maybe add more.
This would not affect Choices - you can add a choice list of arbitrary length.
User avatar
evilC
Posts: 4175
Joined: 27 Feb 2014, 12:30

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

27 May 2018, 13:38

Version 0.1.0 has now been released.
https://github.com/evilC/HotVoice/releases/tag/v0.1.0
Syntax has completely changed - there are a few more steps involved now for a basic setup, but the power and flexibility of it increased massively.

I hope I struck the right balance.
I could maybe re-add equivalents to the old methods to enable simple one-line additions though

Thoughts?
burque505
Posts: 437
Joined: 22 Jan 2017, 19:37

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

27 May 2018, 13:53

Hi, I get this error and the PowerShell command doesn't cure it. I tried running it in the script folder and the lib folder.
EDIT: AHK_L 1.1.28.02 U64, Win7 SP1 64-bit
EDIT: I had long ago changed references to "null" in CLR.ahk to "nulo" for the same reason you mention in the script, AHK_H compatibility. I commented out the CLR section in the script and referenced my own lib, but got the same result (which seems only logical).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

burque505
Posts: 437
Joined: 22 Jan 2017, 19:37

Re: HotVoice - Speech Recognition + Volume detection for AHK (C# DLL)

27 May 2018, 17:51

In 0.0.3 and 0.0.4, the gui displays but HotVoice.dll won't load. In 0.1.0, the gui does not display and HotVoice.dll won't load.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: IOrot and 13 guests