Page 1 of 1

Speech Recognizer for harbour App ?

Posted: Fri Apr 28, 2023 9:26 pm
by Jimmy
hi,

it is no Problem to "read" a Text and that let Windows "speak" it

Cortana or Alexa can "listen" to what you speak ... Window have "SpeechRecognition" API
did somebody use "SpeechRecognition" API :?:

... would be nice to use "SpeechRecognition" for ChatGPT ;)

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 6:59 am
by Antonio Linares

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 7:04 am
by Antonio Linares
With FWH please review samples\voice.prg

Code: Select all | Expand

#include "FiveWin.ch" 

function Main() 

   local oVoice := TOleAuto():New( "Sapi.SPVoice" ) 

   oVoice:Speak( "Good morning" ) 
   oVoice:Speak( "I am here to serve you" ) 
   oVoice:Speak( "Is there something that I can do for you today ?" ) 

return nil

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 7:13 am
by Antonio Linares
Turn on voice typing

Press Windows logo key + H on a hardware keyboard when you are on an EDIT (GET) control

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 7:16 am
by Jimmy
hi Antonio,
Yes, that is nice :D
Antonio Linares wrote:With FWH please review samples\voice.prg
as i wrote it is easy to use "Sapi.SPVoice" to "read" TEXT and than let PC "speak" it

i like to "speak" to harbour App like in ChatGPT Demo
as i understand newer Version of SAPI have also "SpeechRecognition" so i search for Sample

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 7:20 am
by Antonio Linares
https://www.autoitscript.com/forum/topi ... cognition/

Code: Select all | Expand

Local $RecoContext =ObjCreate("SAPI.SpSharedRecoContext")
If @Error Then
    Msgbox(0,"","Error Creating $RecoContext: "&@Error)
    Exit
EndIf

Local $SinkObject =ObjEvent($RecoContext,"MyEvent_")
Local $Grammar =$RecoContext.CreateGrammar(1)
$Grammar.DictationLoad
$Grammar.DictationSetState(1)  ;Start Listening
Sleep(5000)
$Grammar.DictationSetState(0)  ;Stop  Listening

Func MyEvent_Recognition($StreamNumber,$StreamPosition,$RecognitionType,$Result)
    MsgBox(0,"",$Result.PhraseInfo.GetText)
EndFunc

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 7:26 am
by Antonio Linares
This is working. Wondering how to convert this to Harbour: Local $SinkObject =ObjEvent($RecoContext,"MyEvent_")

listen.prg

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local o := CreateObject( "SAPI.SpSharedRecoContext" )
   local oGrammar := o:CreateGrammar( 1 )

   oGrammar:DictationLoad()
   oGrammar:DictationSetState( 1 )
   Sleep( 5000 )
   oGrammar:DictationSetState( 0 )

   MsgInfo( "ok" )

return nil

Re: Speech Recognizer for harbour App ?

Posted: Sat Apr 29, 2023 8:46 am
by Jimmy
hi Antonio,

thx for 1st Step to recognize Speach under harbour
will search forr "SinkObject" for more Information

Re: Speech Recognizer for harbour App ?

Posted: Sun Apr 30, 2023 7:38 am
by Massimo Linossi
Hi Antonio.
Very nice work, many compliments.
I have a little question about. In these years I started to work in Linux and I've found that Tole or Createobject are not
working inside this OS. Is there a workaround for using them ? Any kind of library o something else ?
Thanks a lot
Massimo

Re: Speech Recognizer for harbour App ?

Posted: Sun Apr 30, 2023 10:38 am
by Antonio Linares
Dear Massimo,

Answered by chatGPT 4:
OLE (Object Linking and Embedding) is a technology developed by Microsoft, primarily for use in their Windows operating system and applications like Microsoft Office. It allows users to create compound documents by embedding or linking objects (such as images, spreadsheets, or other documents) from one application into another.

As OLE is a Microsoft technology, it is not natively supported on Linux. However, there are some workarounds that may allow you to use OLE objects on Linux:

Use Wine: Wine is a compatibility layer that allows you to run Windows applications on Linux. You can try installing and running a Windows application that supports OLE objects, such as Microsoft Office, using Wine. However, Wine may not provide full compatibility or the best performance for all applications.

Use a virtual machine: You can install a Windows virtual machine on your Linux system using software like VirtualBox or VMware. This will let you run a full instance of Windows alongside your Linux system, allowing you to use OLE objects within Windows applications.

Use alternative applications: There are many Linux applications that can handle files created with OLE objects, such as LibreOffice, Calligra Suite, or SoftMaker Office. These applications may not support all the features of OLE, but they can usually handle basic functionality like embedding or linking objects.

Use cloud-based services: You can use cloud-based office suites like Microsoft Office 365 or Google Workspace, which are accessible through a web browser on any platform, including Linux. These services often support OLE-like functionality, allowing you to work with files containing embedded or linked objects.

Keep in mind that none of these options provide native support for OLE objects on Linux, and your mileage may vary when it comes to compatibility and functionality.