Voice triger

Creating macros. Working with QM.

Voice triger

Postby ilya1111 on Wed Oct 18, 2017 2:19 pm

Hello guys!
Help please, can I run macros with voice trigger like that- I talk in microphone word, for example "book," and macros is run?
Posts: 23
Joined: Wed Feb 15, 2017 1:39 pm

Re: Voice triger

Postby Gintaras on Wed Oct 18, 2017 7:23 pm

Simplest example. Uses SAPI -Windows speech engine.

But in my tests it rarely recognized words correctly. Maybe I don't speak English correctly, or need some more settings, or need training, or bad sound level, I don't know.

Function Speech_recognition     ?
if(getopt(nthreads)>1) ;;allow single instance
,if('Y'=mes("Already running. Exit?" "Speech_recognition" "YN")) EndThread "Speech_recognition"

typelib SpeechLib {C866CA3A-32F7-11D2-9602-00C04F8EE628} 5.4
SpeechLib.SpSharedRecoContext src._create
ISpRecoContext isrc=+src
;isrc.SetInterest ;;default - only Recognition event
ISpRecoGrammar g
long idGrammar=82658417
isrc.CreateGrammar(idGrammar g)
g.LoadDictation(0 SPLO_STATIC)

;now wait and process messages. Can either:
;1. Show a message box or dialog.
;2. opt waitmsg 1; wait ...
;3. MessageLoop.
if 1
,mes "QM speech recognition example.[][]Say something while this message box is alive."
,AddTrayIcon "$qm$\sound.ico" "QM speech recognition example.[]Ctrl+click to exit."
,opt waitmsg 1
,wait -1 ;;or can wait for some event

#sub src_Recognition
function StreamNumber `StreamPosition RecognitionType SpeechLib.ISpeechRecoResult'Result ;;SpeechLib.ISpeechRecoContext'src
SpeechLib.ISpRecoResult k=+Result
word* w; byte attr
str s.ansi(w)
CoTaskMemFree w

out s ;;the recognized word

;To start a macro, use mac. Don't put macro code here. This function must exit ASAP.
sel s 1
,case "example"
,mac "Example20"
,case "simple"
,mac "Simple5"

err+ out _error.description

Site Admin
Posts: 10385
Joined: Thu Dec 19, 2002 7:36 pm
Location: Lithuania

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests