Jump to content

Utter - Utilizing more of SAPI (Speech Recognition UDF)

Recommended Posts

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Utter is a free ware windows API automation script.It can do most of the sapi dll functions."SAPI" stands for Windows Speech Reconition API,SAPI.dll is the file which manages the speech recognition

Nope it only currently supports English the next update would come with an online speech recognizer which would suite your need. 

Posted Images

i could use a little appreciation for making the script and for updating it  if nobody is there to use it what is its use of putting here

I have plenty of example scripts I have posted that have hundreds of views and no replies.  You will not find cheerleaders here, only questions and critique; and that's on the offhand that what you are doing is both what somebody needs to do, and how they want to do it.  Given the small fraction of users that frequent the forum, and the small fraction of them that actively post, and the small fraction of them that give two fx about your subject matter, consider any replies anomalous.

I find value in the effort of returning half of what i have taken, not in the result.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to post
Share on other sites
Link to post
Share on other sites

Understanding this stuff at 12 isnt reward enough?  my hobbies at 12 were lighting things on fire and watching things that were on fire.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to post
Share on other sites

There's no need to re-declare the variable inside the function, just re-initialize it :)


Global $someVariable = "SomeData"
$someVariable = "SomeOtherData"


If you are only twelve for real, keep it up not many kids your age take interest in jack shit these days. Here is a little stroke for your ego, search for my last post here :P
(Hint: I've been lurking a LONG time lol)

Link to post
Share on other sites

I think you use wrong section in download



it should be:


as this is UDF for one of Windows API


Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * for other useful stuff click the following button:


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2021-10-18

Link to post
Share on other sites

Well this are my suggestions.

Do no use Global into funtions. Autoit is able to make them work correclty. but is no correct in programming do that. (as far I understand I'm not a professional or anything).

Do not use Global every time when you set data in your variables.

If you going to use a Global Array don't need to return that array.

Keep going. at 12 I was working f**k. :/

I did no try the UDF because I don't have SAPI.



Link to post
Share on other sites

I do expect some examples with all UDFs. Is there any ?

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)


Link to post
Share on other sites

I do expect some examples with all UDFs. Is there any ?

search for "Examples" string.



Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Surya
      Utter is simply a UDF created for the maximum utilization of SAPI (Speech Recognition API) in windows you can add your own words to be recognized by the computer you can set speed,picth and select the voice you want by speech synthesis included in windows.Utter can create a free grammar recognition engine as well as custom made grammar recognition engine suiting according to your need also it is flexible.The shutdown function of the UDF must be called before calling another one to destroy the current engine running when autoit closes the engine will also close many functionalities are included an update will be soon in future
      github: https://github.com/thesunRider/Utter
    • By Fenzik
      Hello all"
      I have curious problem with com object implementation of Sapi 5.1.
      In some cases }Some Voice engines] the metods for retrieve the voice parameters fails with error :Member not exists:.
      But the Retrieved Voice object can speak the given text, so It exists and work.
      Example of this type of Engine can be this one: http://download.kobavision.be/KobaSpeech3/KobaSpeech 3 With Vocalizer Serena - English (Great Britain).exe (can work as demo)
      So my question is> Is there some way to workaround or solve this issue?
      What i tryed:
      1. Typical use of Sapi.spvoice object:
      $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler
        $spvoice = ObjCreate("sapi.spvoice")
      for $voice in $spvoice.getvoices()
        msgbox(0, "Voice", $voice.getdescription())
      Func MyErrFunc()
      $HexNumber = hex($oMyError.number, 8)
      Msgbox(0,"","We intercepted a COM Error !" & @CRLF &"Number is: " & $HexNumber & @CRLF &"Windescription is: " & $oMyError.windescription)

      2. Implement workaround based on Nvda Screen reader sapi5 Library at https://github.com/nvaccess/nvda/blob/master/source/synthDrivers/sapi5.py
      Thys code in Pascal should work, so i tryed to reproduce it in Autoit.
      Pascal code just as example:
                   for i:=0 to SOTokens.Count-1 do
                        SOToken:=SOTokens.Item(I); s:=SOToken.GetDescription(0);
      In Autoit I tryed it like this:
      $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler
        $spvoice = ObjCreate("sapi.spvoice")
      for $i = 0 to $spvoice.getvoices.count-1
      $name = $spvoice.getvoices.item($i).getdescription
      msgbox(0,"Voice", $name)
      Func MyErrFunc()
      $HexNumber = hex($oMyError.number, 8)
      Msgbox(0,"","We intercepted a COM Error !" & @CRLF &"Number is: " & $HexNumber & @CRLF &"Windescription is: " & $oMyError.windescription)
      Both of this methods returning same Error ("Member not exists.").
      Thanks a lot for help.
    • By Imperial
      How to make AutoIt Detect Sounds using the Microphone Input to hear you what you said
    • By wakillon
      TinyClipToSpeech v

      Read Clipboard Text Content using Sapi Voice

      Access to all commands by Tray menu.

      If you doesn't have Sapi5 installed, script ask for download it.
      I know there is already some Text to speech scripts,
      but i wanted an easy access ( clipboard content and tray menu )
      and the possibility to change voice and settings while reading.
      Text can be displayed on desktop gradually as what is read.
      You can also save text to mp3 without need of read it.
      My preference goes to Scansoft voices, easy to found and install and with a good pronunciation qualty.

      As usual, some externals files are downloaded at first execution.

      Previous downloads : 199

      Update of 2012-07-01

      Source : TinyClipToSpeech v

      Executable : TinyClipToSpeech.exe.html
      (Once this html file downloaded, double click on it for start the download)
      Hope you like it !
    • By Sori
      Modified version of code here:

      #include <File.au3> #include <Misc.au3> ;Only allow one instance of the program to run. If _Singleton("Voice Commands", 1) = 0 Then Exit EndIf Dim $spokenWords Dim $voiceCommands = _FileListToArray(@WorkingDir & "\Voice Commands") Dim $voiceCommandsCap = $voiceCommands[0] Dim $voiceCommandName Dim $splitCommand Dim $splitRecognition Dim $parameter Dim $sendParameter Dim $count Dim $skipSearch Dim $transcriptionMode Global $h_Context = ObjCreate("SAPI.SpInProcRecoContext") Global $h_Recognizer = $h_Context.Recognizer Global $h_Grammar = $h_Context.CreateGrammar(1) $h_Grammar.Dictationload $h_Grammar.DictationSetState(1) ;Create a token for the default audio input device and set it Global $h_Category = ObjCreate("SAPI.SpObjectTokenCategory") $h_Category.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") Global $h_Token = ObjCreate("SAPI.SpObjectToken") $h_Token.SetId("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn\") $h_Recognizer.AudioInput = $h_Token Global $i_ObjInitialized = 0 Global $h_ObjectEvents = ObjEvent($h_Context, "SpRecEvent_") If @error Then ConsoleWrite("ObjEvent error: " & @error & @CRLF) $i_ObjInitialized = 0 Else ConsoleWrite("ObjEvent created Successfully!" & @CRLF) $i_ObjInitialized = 1 EndIf While $i_ObjInitialized Sleep(5000) ;Allow the Audio In to finalize processing on the last 5 second capture $h_Context.Pause ;Resume audio in processing $h_Context.Resume ;Reset event function allocation (what is this? I think its garbage collection or something, needs clarification) $h_ObjectEvents = ObjEvent($h_Context, "SpRecEvent_") WEnd Func SpRecEvent_Hypothesis($StreamNumber, $StreamPosition, $Result) ConsoleWrite("Hypothesis(): Hypothized text is: " & $Result.PhraseInfo.GetText & @CRLF) EndFunc ;==>SpRecEvent_Hypothesis Func SpRecEvent_Recognition($StreamNumber, $StreamPosition, $RecognitionType, $Result) ConsoleWrite($RecognitionType & "||" & $Result.PhraseInfo.GetText & @CRLF) $spokenWords = $Result.PhraseInfo.GetText CheckCommands() EndFunc ;==>SpRecEvent_Recognition Func SpRecEvent_SoundStart($StreamNumber, $StreamPosition) ConsoleWrite("Sound Started" & @CRLF) EndFunc ;==>SpRecEvent_SoundStart Func SpRecEvent_SoundEnd($StreamNumber, $StreamPosition) ConsoleWrite("Sound Ended" & @CRLF) EndFunc ;==>SpRecEvent_SoundEnd Func CheckCommands() ;=== Special Voice Commands === ;-- Transcription Mode-- If $spokenWords = "Transcription Mode" Then If $transcriptionMode = 0 Then $transcriptionMode = 1 ConsoleWrite("Transcription Mode On" & @CRLF) $skipSearch = 1 Else $transcriptionMode = 0 ConsoleWrite("Transcription Mode Off" & @CRLF) $skipSearch = 1 EndIf EndIf If $transcriptionMode = 1 Then If $spokenWords <> "Transcription Mode" Then Send($spokenWords) $skipSearch = 1 EndIf Else $skipSearch = 0 EndIf ;--------- ;============================== If $skipSearch = 0 Then ;=== Voice Command Search === ;%% in the file name denotes that whatever is said after the command, should be sent as a parameter $count = 1 While $count <= $voiceCommandsCap ConsoleWrite("count: " & $count & @CRLF) ConsoleWrite($voiceCommands[$count] & @CRLF) If StringInStr($voiceCommands[$count], "%%") <> 0 Then ConsoleWrite("found %%" & @CRLF) $splitCommand = StringSplit($voiceCommands[$count], " %%") If $splitCommand[0] > 2 Then $voiceCommandName = $splitCommand[1] & " " & $splitCommand[2] Else $voiceCommandName = $splitCommand[1] EndIf $splitRecognition = StringReplace($spokenWords, $voiceCommandName & " ", "") ;$splitRecognition = StringSplit($spokenWords, $voiceCommandName) ConsoleWrite("spokenWords: " & $spokenWords & @CRLF) ;ConsoleWrite("split By: " & $voiceCommandName & @CRLF) ConsoleWrite("splitRecognition: " & $splitRecognition & @CRLF) ;$parameter = $splitRecognition[1] $parameter = $splitRecognition $sendParameter = 1 ConsoleWrite("voiceCommandName: " & $voiceCommandName & @CRLF) ConsoleWrite("Parameter: " & $parameter & @CRLF) Else $splitCommand = StringSplit($voiceCommands[$count], ".au3") $voiceCommandName = $splitCommand[1] $sendParameter = 0 EndIf $count = $count + 1 WEnd ConsoleWrite("Checking Command to List" & @CRLF) If StringInStr($spokenWords, $voiceCommandName) <> 0 Then If $sendParameter = 1 Then Run(@WorkingDir & "\Voice Commands\" & $voiceCommandName & " %%.exe " & $parameter) ;Run("AutoIt3.exe " & $voiceCommandName &"%%.au3" & $parameter) Else ShellExecute(@WorkingDir & "\Voice Commands\" & $voiceCommandName & ".exe") ;Run("AutoIt3.exe " & $voiceCommandName &".au3") EndIf EndIf ;============================== EndIf $skipSearch = 0 EndFunc ;==>CheckCommands My issue is with the recognition itself.
      It's too often that the engine does not recognize what I'm saying.
      I've tried searching for the recognition information, training, etc... but I'm not finding what I need.
      I think I can use last hypothesized entry to check the commands, but....
      I'm not sure how to get only the last entry for the hypothesis.
      If you look in the console as you speak, the hypothesis is constantly changing until you stop speaking. So I'm fairly certain I need to check for a pause in speech to use this method.
      Is the voice recognition engine shared amongst all programs?
      Is there a good application to train the voice recognition?
      The code is terribly inefficient at the moment. It's a work in progress. After I get it to recognize my voice, then I'll work on making the actual commands better optimized.
  • Create New...