Speech Recognizer for harbour App ?

Post Reply
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Speech Recognizer for harbour App ?

Post 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 ;)
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post by Antonio Linares »

Turn on voice typing

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

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Speech Recognizer for harbour App ?

Post 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
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1733
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Speech Recognizer for harbour App ?

Post by Jimmy »

hi Antonio,

thx for 1st Step to recognize Speach under harbour
will search forr "SinkObject" for more Information
greeting,
Jimmy
User avatar
Massimo Linossi
Posts: 506
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Speech Recognizer for harbour App ?

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Speech Recognizer for harbour App ?

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply