SAPI Speech Recognition ,talkback sample ,class in masm

Started by ToutEnMasm, June 11, 2009, 07:48:55 PM

Previous topic - Next topic

ToutEnMasm

Hello,
This one is a ource on speech recognition.It's here to help going further.
It use the "ready to use SDK RC 7"
To use the sapi you need to install it.
http://www.e-speaking.com/installsapi.htm

The sample c++ is here
http://www.microsoft.com/downloads/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&displaylang=en

A little amelioration is that the writing is made in an output window instead of a dos windows.
The file who do that is an include file,that i call a class in masm.One line is enough to create the window
Others class exist see my site.

Use ml 6.15 to compile it,9 made an internal error

[attachment deleted by admin]

Farabi

You did not say if you upload something interesting.

I used the SAPI TTS Interface like this


.data
IID_ISpVoice   GUID {06C44DF74h,072B9h,04992h,<0A1h,0ECh,0EFh,099h,06Eh,004h,022h,0D4h>}
vi dword 0
.code
SpeakInit proc uses esi edi

invoke GetInterfaceFromProgId,CADD("SAPI.SpVoice.1"),addr IID_ISpVoice
.if eax==0
invoke MessageBox,0,CADD("Something was wrong"),0,0
.else
mov vi,eax
.endif

ret
SpeakInit endp

SpeakSetVolume proc uses esi edi nVolume:dword
LOCAL x:dword
;STISpVoice.SetVolume

push nVolume
mov esi,vi
push esi
mov esi,[esi]
call [esi].STISpVoice.SetVolume

ret
SpeakSetVolume endp

Speak proc uses esi edi lpText:dword
LOCAL buff[256]:dword

invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED,lpText,-1,addr buff,sizeof buff


push SPF_DEFAULT
lea eax,buff
push eax
mov esi,vi
push esi
mov esi,[esi]
call [esi].STISpVoice.Speak
.if eax!=0
; xchg edx,eax
; invoke dw2a,edx,addr buff
; invoke MessageBox,0,addr buff,0,0
.endif

ret
Speak endp


Use it like this

invoke SpeakInit
invoke SpeakSetVolume,100
invoke Speak,CADD("System initiated, all system green.")
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

UtillMasm

C:\talkback>build_for_XPSP2SDK.bat
Could Not Find C:\talkback\*.pdb
Could Not Find C:\talkback\*.ilk
Could Not Find C:\talkback\*.obj
Could Not Find C:\talkback\*.exe
Press any key to continue . . .
Microsoft (R) Windows (R) Resource Compiler, Version 5.00.1823.1 - Build 1823
Copyright (C) Microsoft Corp. 1985-1998. All rights reserved.

Using codepage 1252 as default
Creating talkback.RES
RC: RCPP -CP 1252 -f C:\talkback\RCa01980 -g C:\talkback\RDa01980 -DRC_INVOKED -
D_WIN32 -pc\:/ -E -I. -I . -I ..\sdkrc7

talkback.rc.
Writing MENU:MAIN,      lang:0x409,     size 148.
Writing VERSION:IDR_VERSION1,   lang:0x409,     size 840
Microsoft (R) Windows Resource To Object Converter Version 5.00.1736.1
Copyright (C) Microsoft Corp. 1992-1997. All rights reserved.

Assembling: talkback.asm
talkback.asm(138) : error A2006: undefined symbol : eEventId
talkback.asm(139) : error A2006: undefined symbol : eEventId
talkback.asm(140) : error A2006: undefined symbol : elParamType
Press any key to continue . . .

ToutEnMasm


The "couldn't find  files .."  is normal in the batch.The compiled files are already deleted.It is made for further build.
Quote
talkback.asm(138) : error A2006: undefined symbol : eEventId
Open the sapi51.sdk , change the "IF 0" in "IF MASM32" and all will be OK
IF 0 is not understand by masm.   line 1199
Quote
You did not say if you upload something interesting
I have changed of post only to have a title more adapted to the subject.He can be found more easily on the forum and on internet.




Farabi

Tout, are you sure the dstrText is on ASCII format? I think it was on unicode format.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

UtillMasm

 :U
C:\talkback>build_for_XPSP2SDK.bat
Could Not Find C:\talkback\*.pdb
Could Not Find C:\talkback\*.ilk
Could Not Find C:\talkback\*.obj
Could Not Find C:\talkback\*.exe
Press any key to continue . . .
Microsoft (R) Windows (R) Resource Compiler, Version 5.00.1823.1 - Build 1823
Copyright (C) Microsoft Corp. 1985-1998. All rights reserved.

Using codepage 1252 as default
Creating talkback.RES
RC: RCPP -CP 1252 -f C:\talkback\RCa00164 -g C:\talkback\RDa00164 -DRC_INVOKED -
D_WIN32 -pc\:/ -E -I. -I . -I ..\sdkrc7

talkback.rc.
Writing MENU:MAIN,      lang:0x409,     size 148.
Writing VERSION:IDR_VERSION1,   lang:0x409,     size 840
Microsoft (R) Windows Resource To Object Converter Version 5.00.1736.1
Copyright (C) Microsoft Corp. 1992-1997. All rights reserved.

Assembling: talkback.asm
Press any key to continue . . .
Press any key to continue . . .

C:\talkback>dir/a/b/o/p
.pdb
build_for_VistaSDK.bat
build_for_XPSP2SDK.bat
macro.inc
notes.rtf
output.inc
RCa01928
talkback.asm
talkback.bin
talkback.exe
talkback.ilk
talkback.obj
talkback.rc
talkback.RES

C:\talkback>

ToutEnMasm


Quote
Tout, are you sure the dstrText is on ASCII format? I think it was on unicode format.

Not sure.It's a draft needing some changes .I verify this.

ToutEnMasm


I have uploaded in my first post the source code of the final sample.
The shift in 64 bits with a 32 bits processor is solved (with the help of the forum,thanks to jj2007).
For 64 bits processor , this work but i have put the possible modify in comment.

ToutEnMasm


You can also use the ddk 6001 (actual) build environment to compile it.
Quote
Microsoft (R) Macro Assembler Version 8.00.50727.278
The ddk 6001 is usefull with the vc++ 2008 express edition,he have mfc and atl.