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

Post your working scripts, libraries and tools for AHK v1.1 and older
ghostyzx
Posts: 2
Joined: 09 Dec 2018, 16:54

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

Post by ghostyzx » 11 Dec 2018, 19:46

Awesome! Thanks a lot!
evilC wrote:
11 Dec 2018, 14:08
Version 0.1.3 released - implemented ghostyzx's request

https://github.com/evilC/HotVoice/releases/tag/v0.1.3

Code: Select all

### Added
- Add StopRecognizer() endpoint

r2997790
Posts: 71
Joined: 02 Feb 2017, 02:46

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

Post by r2997790 » 12 Dec 2018, 08:42

evilC wrote:
11 Dec 2018, 13:22
This library does not support recognition of arbitrary words - you need to give it a list of all possible application names in order to support this.

See how the demo code implements the "call name on their phone" example
Hi evilC, yes sorry, I didn't mean arbitary words, I was meaning to specify the 'input/recognised strings' but I was curious -- because I couldnt figure out how to -- how make it accept multiple words as an defined string.

So, rather than just a single word, several words, so eg. "Open Word" and "Open Excel" were both defined as trigger words.

Is that possible? I had a look at the Demo.ahk but I couldn't figure it -- I've had a hack around with the simple demo which works great, could you shed any light on how to adapt it to cope with multi-word strings like above?

Thanks a million. Love the potential of this!

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

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

Post by evilC » 12 Dec 2018, 10:17

Here is the pertinent code from the demo - it creates the grammar "Call [Anne|Mary|James|Sam] on [his|her] [cell|home|work] phone"
Where [his|her] etc is a choice.

You would want to set up a grammar like "Launch [Word|Excel|PowerPoint]"

Code: Select all

contactGrammar := hv.NewGrammar()
contactGrammar.AppendString("Call")
femaleGrammar := hv.NewGrammar()
femaleChoices := hv.NewChoices("Anne, Mary")
femaleGrammar.AppendChoices(femaleChoices)
femaleGrammar.AppendString("on-her")
maleGrammar := hv.NewGrammar()
maleChoices := hv.NewChoices("James, Sam")
maleGrammar.AppendChoices(maleChoices)
maleGrammar.AppendString("on-his")
contactGrammar.AppendGrammars(maleGrammar, femaleGrammar)
phoneChoices := hv.NewChoices("cell, home, work")
contactGrammar.AppendChoices(phoneChoices)
contactGrammar.AppendString("phone")
hv.LoadGrammar(contactGrammar, "CallContact", Func("CallContact"))

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

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

Post by evilC » 12 Dec 2018, 10:24

Actually, the Choices Example.ahk file is a much simpler example

Here is it roughly adapted to what you want (Not tested)

Code: Select all

#SingleInstance force
#Persistent ; You will need this if your script creates no hotkeys or has no GUI
; Load the HotVoice Library
#include Lib\HotVoice.ahk
; Create a new HotVoice class
hv := new HotVoice()
; Initialize HotVoice and tell it what ID Recognizer to use
hv.Initialize(0)
; Create a new Grammar
testGrammar := hv.NewGrammar()
; Add the word "Open" to it
testGrammar.AppendString("Open")
; Create a new Choices object with choices
appChoices:= hv.NewChoices("Word, Excel, PowerPoint, Outlook")
; Add the choices to the Grammar
testGrammar.AppendChoices(appChoices)
; Load the Grammar
hv.LoadGrammar(testGrammar, "OpenApp", Func("MyFunc"))
hv.StartRecognizer()
return

MyFunc(grammarName, words){
    ToolTip % "Command: " grammarName " " words[2]
}

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

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

Post by evilC » 12 Dec 2018, 10:34

Thinking about it, I suppose it would be entirely possible to write some code such that you could just supply a string in the form "Launch [Word|Excel|PowerPoint]" and it just works it out for you - If I get some time at some point, I will look into it.

r2997790
Posts: 71
Joined: 02 Feb 2017, 02:46

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

Post by r2997790 » 12 Dec 2018, 11:32

OMG... on closer scrutiny I found what I was trying to say evilC...

... all I was trying to figure out was how to post multiple word triggers, eg. "Fry Eggs", "Cook Bacon" etc... the answer I see now was...

A humble... -

So, cook-bacon, fry-eggs --- just using a - lets you have multiple word triggers.

Sorry to have troubled you / and the crossed wires!

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

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

Post by evilC » 12 Dec 2018, 13:07

If you are adding words such as "Open-Word" "Close-Word" etc then while it will work, this is not the best way to do it.
You want to build the phrase "[Open|Close] [Word|Excel|Powerpoint]"
That way, you need one phrase, and it handle both open or close commands for any of the specified apps.
If you said "Open Word", then MyFunc would get called, and words[1] would be "Open" and words[2] would be "Word".

User avatar
Scoox
Posts: 125
Joined: 11 May 2014, 09:12
Location: China

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

Post by Scoox » 01 Apr 2019, 23:16

Just stumbled upon this and downloaded the repo, however it seems the file hotvoice.dll is missing from lib dir, script throws error message saying "unable to find lib\hotvoice.dll, exiting..."

gregster
Posts: 8991
Joined: 30 Sep 2013, 06:48

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

Post by gregster » 02 Apr 2019, 02:25

Scoox wrote:
01 Apr 2019, 23:16
Just stumbled upon this and downloaded the repo, however it seems the file hotvoice.dll is missing from lib dir, script throws error message saying "unable to find lib\hotvoice.dll, exiting..."
Use Hotvoice.zip on the 'releases' page for download: https://github.com/evilC/HotVoice/releases
It contains the folder named lib and the dll (among other files).


User avatar
Scoox
Posts: 125
Joined: 11 May 2014, 09:12
Location: China

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

Post by Scoox » 02 Apr 2019, 07:06

Cool thanks guys, I will after work

cyso
Posts: 2
Joined: 14 Apr 2019, 11:27

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

Post by cyso » 14 Apr 2019, 12:11

Thank you very much for your work, it is a wonderful project and gives me a lot of pleasure.
I would like to solve the following issue, maybe i just miss something.

My voice input starts with a Grammar Objects 'move'. In a NewChoice object I have two possibilities 'x, y'. but I want to cover three cases:
- move
- move x
- move y
So in case I pronounce move without x or y, the NewChoice value remains empty and I can continue working with it.
I think I'm too stupid for that. Inserting an empty string with hv.NewChoices("x, y, ") doesn't work, but would be a great way. As I understand it now, the NewChoice object forces an input and can't be empty.
Are there ways to solve this within a Grammer object?

I'm sorry if I didn't understand something and also for my bad English.

Thank You!

#######################
moveGrammar := hv.NewGrammar()
moveGrammar.AppendString("move")

move_directionPhrase := hv.NewGrammar()
move_directionChoices := hv.NewChoices("x, y")
move_directionPhrase.AppendChoices(move_directionChoices)

moveGrammar.AppendGrammars(move_directionPhrase)

LV_Add(, "Move", hv.LoadGrammar(moveGrammar, "Move", Func("Move")))
#######################


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

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

Post by evilC » 01 Jul 2019, 16:13

HotVoice 0.1.4 has been released!
The demo has been greatly improved, and now supports selecting language
The demo also now has commands for French as well as English, and should not crash if recognizer 0 is not English

IF YOU SPEAK A NON-ENGLISH LANGUAGE, PLEASE HELP ME UPDATE THE DEMO WITH OTHER LANGUAGES!

robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

Post by robodesign » 01 Jul 2019, 17:27

I speak Romanian. Eager to help. Would you like Romanian? ^_^
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.


User avatar
elModo7
Posts: 217
Joined: 01 Sep 2017, 02:38
Location: Spain
Contact:

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

Post by elModo7 » 18 Jul 2019, 05:49

I could add Spanish to it, I did use this a few months ago and it was really cool.
Will try to get some spare time and try to add something to the demo.

scriptor2016
Posts: 849
Joined: 21 Dec 2015, 02:34

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

Post by scriptor2016 » 07 Jan 2020, 09:24

Hey I was just wondering, can anyone confirm this works on Windows 7? I get the following error when trying to run the script:


HotVoice.dll failed to load

Dll may be blocked. Try running the powershell command Get-ChildItem -Path '.'-Recurse Unblock-File in the script folder


So then I right-click the file named "Unblocker.ps1" and select 'Run With Powershell'. It opens up an ms-dos window and hangs for a few seconds.

But then same problem all over again, and I get the same error message.

It would be amazing if I could get this working :)


scriptor2016
Posts: 849
Joined: 21 Dec 2015, 02:34

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

Post by scriptor2016 » 08 Jan 2020, 00:00

no luck. no matter what I do, the same error message keeps popping up. It's a shame, it looks like the demand for this script is huge- lots of users are interested.

I'm thinking this might be a win7 vs. win10 issue?

Post Reply

Return to “Scripts and Functions (v1)”