Novembre 2024 | Lun | Mar | Mer | Jeu | Ven | Sam | Dim |
---|
| | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | Calendrier |
|
|
| utilisation de SAPI 4 pour la synthèse vocale | |
| | Auteur | Message |
---|
Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: utilisation de SAPI 4 pour la synthèse vocale Mer 11 Mai 2011 - 10:52 | |
| Bonjour, J'ai installé SAPI 4 sur ma machine (je n'ai pas réussi à installer le 5). J'ai trouvé différentes DLL et différentes source dont certaines en PUREBASIC avec des librairies (lien sur le sujet: [Sujet: SAPI 4 et 5 en NATIF sur le forum PUREBASIC] Je mets une des DLL qui me semble simple en lien: Voir le Fichier : voice.zip(il y avait aussi TTS.DLL que l'on peut trouver sur le net) Je n'ai pas réussi à l'utiliser. Quelqu'un peut-il m'aider, je pense que la synthèse vocale pourrait interesser du monde et enrichir nos créations Il y a aussi [Site du logiciel Espeak] qui est interessant logiciel open source de synthèse vocale | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Mer 11 Mai 2011 - 13:53 | |
| Voici le code en Freebasic de voice.bi (sans doute pour du SAPI 5): - Code:
-
'under construction by Volta and based on speech in freebasic by Jim 'http://dbfinteractive.com/index.php?topic=1161.0
#Ifndef WIN_INCLUDEALL #Define WIN_INCLUDEALL #EndIf #Include Once "windows.bi"
#Define SPF_DEFAULT 0 #Define SPF_ASYNC 1 #Define SPF_PURGEBEFORESPEAK 2 #Define SPF_IS_FILENAME 4 #Define SPF_IS_XML 8 #Define SPF_IS_NOT_XML 16 #Define SPF_PERSIST_XML 32 #Define SPF_NLP_SPEAK_PUNC 64 #Define SPF_NLP_MASK 64 #Define SPF_VOICE_MASK 127 #Define SPF_UNUSED_FLAGS -128
Type ISpVoiceVtbl_ As ISpVoiceVtbl
Type ISpVoice lpVtbl As ISpVoiceVtbl_ Ptr End Type
Type ISpVoiceVtbl ' iunknown QueryInterface As Function(ByVal As ISpVoice Ptr, ByVal As IID Ptr, ByVal As Any Ptr) As HRESULT AddRef As Function(ByVal As ISpVoice Ptr) As ULong Release As Function(ByVal As ISpVoice Ptr) As ULong
' stubs SetNotifySink As Function() As HRESULT SetNotifyWindowMessage As Function() As HRESULT SetNotifyCallbackFunction As Function() As HRESULT SetNotifyCallbackInterface As Function() As HRESULT SetNotifyWin32Event As Function() As HRESULT WaitForNotifyEvent As Function() As HRESULT GetNotifyEventHandle As Function() As HRESULT SetInterest As Function() As HRESULT GetEvents As Function() As HRESULT GetInfo As Function() As HRESULT SetOutput As Function() As HRESULT GetOutputObjectToken As Function() As HRESULT GetOutputStream As Function() As HRESULT
' done Pause As Function(ByVal As ISpVoice Ptr) As HRESULT Resume As Function(ByVal As ISpVoice Ptr) As HRESULT
' stubs SetVoice As Function() As HRESULT GetVoice As Function() As HRESULT
' done Speak As Function(ByVal As ISpVoice Ptr, ByVal pwcs As WString Ptr, ByVal dwFlags As Dword, ByVal pulStreamNumber As ULong Ptr) As HRESULT
' stubs SpeakStream As Function() As HRESULT GetStatus As Function() As HRESULT Skip As Function(ByVal As ISpVoice Ptr, ByVal pItemType As WString Ptr, ByVal lNumItems As Long, ByVal pulNumSkipped As ULong Ptr) As HRESULT SetPriority As Function() As HRESULT GetPriority As Function() As HRESULT SetAlertBoundary As Function() As HRESULT GetAlertBoundary As Function() As HRESULT
' done SetRate As Function(ByVal As ISpVoice Ptr, ByVal RateAdjust As Integer) As HRESULT GetRate As Function(ByVal As ISpVoice Ptr, ByVal RateAdjust As Integer Ptr) As HRESULT SetVolume As Function(ByVal As ISpVoice Ptr, ByVal usVolume As UShort) As HRESULT GetVolume As Function(ByVal As ISpVoice Ptr, ByVal pusVolume As UShort Ptr) As HRESULT WaitUntilDone As Function(ByVal As ISpVoice Ptr, ByVal msTimeout As ULong) As HRESULT SetSyncSpeakTimeout As Function(ByVal As ISpVoice Ptr, ByVal msTimeout As ULong) As HRESULT GetSyncSpeakTimeout As Function(ByVal As ISpVoice Ptr, ByVal msTimeout As ULong Ptr) As HRESULT SpeakCompleteEvent As Function(ByVal As ISpVoice Ptr) As HANDLE
' stubs IsUISupported As Function() As HRESULT DisplayUI As Function() As HRESULT End Type #define ISpVoice_QueryInterface(This,riid,ppvObject) (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define ISpVoice_AddRef(This) (This)->lpVtbl -> AddRef(This) #define ISpVoice_Release(This) (This)->lpVtbl -> Release(This) #define ISpVoice_Pause(This) (This)->lpVtbl -> Pause(This) #define ISpVoice_Resume(This) (This)->lpVtbl -> Resume(This) '#define ISpVoice_SetVoice(This,pToken) (This)->lpVtbl -> SetVoice(This,pToken) '#define ISpVoice_GetVoice(This,ppToken) (This)->lpVtbl -> GetVoice(This,ppToken) #define ISpVoice_Speak(This,pwcs,dwFlags,pulStreamNumber) (This)->lpVtbl -> Speak(This,pwcs,dwFlags,pulStreamNumber) #define ISpVoice_Skip(This,pItemType,lNumItems,pulNumSkipped) (This)->lpVtbl -> Skip(This,pItemType,lNumItems,pulNumSkipped) #define ISpVoice_SetRate(This,RateAdjust) (This)->lpVtbl -> SetRate(This,RateAdjust) #define ISpVoice_GetRate(This,pRateAdjust) (This)->lpVtbl -> GetRate(This,pRateAdjust) #define ISpVoice_SetVolume(This,usVolume) (This)->lpVtbl -> SetVolume(This,usVolume) #define ISpVoice_GetVolume(This,pusVolume) (This)->lpVtbl -> GetVolume(This,pusVolume) #define ISpVoice_WaitUntilDone(This,msTimeout) (This)->lpVtbl -> WaitUntilDone(This,msTimeout) #define ISpVoice_SetSyncSpeakTimeout(This,msTimeout) (This)->lpVtbl -> SetSyncSpeakTimeout(This,msTimeout) #define ISpVoice_GetSyncSpeakTimeout(This,pmsTimeout) (This)->lpVtbl -> GetSyncSpeakTimeout(This,pmsTimeout) #define ISpVoice_SpeakCompleteEvent(This) (This)->lpVtbl -> SpeakCompleteEvent(This)
Dim Shared voice As ISpVoice Ptr
Sub voice_ini () Dim IID_ISpVoice As GUID => ( &H6c44df74, &H72b9, &H4992, {&Ha1, &Hec, &Hef, &H99, &H6e, &H04, &H22, &Hd4 }) Dim CLSID_SpVoice As GUID => ( &H96749377, &H3391, &H11d2, {&H9e, &He3, &H00, &Hc0, &H4f, &H79, &H73, &H96 }) CoInitialize(NULL) CoCreateInstance(@CLSID_SpVoice, NULL, CLSCTX_ALL, @IID_ISpVoice, Cast (Any Ptr, @voice)) End Sub
Sub voice_end () ISpVoice_SetRate(voice,0) ISpVoice_Release(voice) CoUninitialize() End Sub
'Wählt eine Stimmenimplementierung aus.<VOICE>[REQUIRED = string][OPTIONAL = string] 'Beispiele: '<VOICE REQUIRED="NAME=Microsoft Mike">…</VOICE> '<VOICE REQUIRED="NAME=Microsoft Mary">…</VOICE> '<VOICE REQUIRED="NAME=Microsoft Sam">…</VOICE> Function v_speaker(n As Integer) As String Select Case n Case 1 Function = "<voice required="+Chr(34)+"Gender=Male"+Chr(34)+"> " Case 2 Function = "<voice required="+Chr(34)+"NAME=Microsoft Mike"+Chr(34)+"> " Case 3 Function = "<voice required="+Chr(34)+"NAME=Microsoft Mary"+Chr(34)+"> " Case 4 Function = "<voice required="+Chr(34)+"NAME=Microsoft Sam"+Chr(34)+"> " Case 5 Function = "<voice required="+Chr(34)+"NAME=LH Stefan"+Chr(34)+"> " Case 6 Function = "<voice required="+Chr(34)+"NAME=LH Anna"+Chr(34)+"> " Case Else Function = "<voice required="+Chr(34)+"Gender=Female"+Chr(34)+"> " End Select End Function
'Setzt die Sprachgeschwindigkeit <RATE>[SPEED = int][ABSSPEED = int ] 'Beispiele: '<RATE SPEED="10">quickly spoken text</RATE> '<RATE SPEED="-10">slowly spoken text</RATE> Function v_speed(n As Integer) As String Function = "<rate absspeed="+Chr(34)+Str(n)+Chr(34)+"> " End Function
'Setzt die Stimmhöhe.<PITCH>MIDDLE = string [ABSMIDDLE = string] 'Beispiele: '<PITCH MIDDLE="10">high pitch</PITCH> '<PITCH MIDDLE="-10">low pitch</PITCH> Function v_pitch(n As Integer) As String Function = "<pitch absmiddle="+Chr(34)+Str(n)+Chr(34)+"> " End Function
'Setzt die Lautstärke <VOLUME> LEVEL = int 'Beispiele: '<VOLUME LEVEL="100">This is loud!</VOLUME> '<VOLUME LEVEL="10">This is pretty soft!</VOLUME> Function v_volumen(n As Integer) As String Function = "<volume level="+Chr(34)+Str(n)+Chr(34)+"> " End Function
'gut verständlich mit den deutschen Stimmen LH Anna oder LH Stefan 'http://msdn2.microsoft.com/en-us/library/ms723629(VS.85).aspx Function say_time (s As String = Time) As String Function = "<context ID = "+Chr(34)+"time"+Chr(34)+">"+s+"</context>" End Function
Function say_date (s As String = Date) As String Function = "<context ID = "+Chr(34)+"date_mdy"+Chr(34)+">"+ s +"</context>" End Function
Function say_number (n As Integer) As String Function = "<context ID = "+Chr(34)+"number_cardinal"+Chr(34)+">"+ Str(n) +"</context>" End Function
Function say_decimal (n As Single) As String Function = "<context ID = "+Chr(34)+"number_decimal"+Chr(34)+">"+ Str(n) +"</context>" End Function
Function say_price (s As String) As String Function = "<context ID = "+Chr(34)+"Currency"+Chr(34)+">"+ s +"</context>" End Function
Function say_url (s As String) As String Function = "<context ID = "+Chr(34)+"web_url"+Chr(34)+"> "+ s +"</context>" End Function
Sub say (s As String) If WaitForSingleObject(ISpVoice_SpeakCompleteEvent(voice), 0) Then Exit Sub ISpVoice_Speak(voice, s, SPF_ASYNC, NULL) End Sub
Sub read_file (s As String) If WaitForSingleObject(ISpVoice_SpeakCompleteEvent(voice), 0) Then Exit Sub ISpVoice_Speak(voice, s, SPF_IS_FILENAME, NULL) ISpVoice_WaitUntilDone(voice, INFINITE) End Sub
ainsi que le code pour le tester en Free - Code:
-
#Include Once "voice.bi"
'Hilfsdefinitionen #Define Frau say v_speaker(0)+ #Define Mann say v_speaker(1)+ #Define Mike say v_speaker(2)+ #Define Mary say v_speaker(3)+ #Define Sam say v_speaker(4)+ #Define Steffan say v_speaker(5)+ #Define Anna say v_speaker(6)+ #Define warte ISpVoice_WaitUntilDone(voice, INFINITE)
voice_ini
say "under construction by Volta" warte Frau say_date warte Mann v_speed(-2) + v_pitch(+10) + say_time warte Mike v_speed(-2) + "ich bin ein Berliner" warte Mary say_price("$1031.40") warte 'read_file("c:/FB0200b/sapi_test.bas")
'funktioniert nur mit den deutschen Stimmen Steffan v_speed(-4) + __FB_SIGNATURE__ warte Anna say_price("€31.40") warte Steffan say_url("w w w .freebasic-portal.d e") warte
voice_end
| |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Mer 11 Mai 2011 - 13:57 | |
| Pour sapi 4 en FreeBasic: code de sapi.bi: - Code:
-
'================================================================================ 'Enum - Microsoft Speech Object Library?{C866CA3A-32F7-11D2-9602-00C04F8EE628} '================================================================================ '================================================================================ Type SpeechDataKeyLocation As Integer ' '================================================================================ Const SDKLDefaultLocation As integer=0 'Const SDKLDefaultLocation As integer=0 Const SDKLCurrentUser As integer=1 'Const SDKLCurrentUser As integer=1 Const SDKLLocalMachine As integer=2 'Const SDKLLocalMachine As integer=2 Const SDKLCurrentConfig As integer=5 'Const SDKLCurrentConfig As integer=5
'================================================================================ Type SpeechTokenContext As Integer ' '================================================================================ Const STCInprocServer As integer=1 'Const STCInprocServer As integer=1 Const STCInprocHandler As integer=2 'Const STCInprocHandler As integer=2 Const STCLocalServer As integer=4 'Const STCLocalServer As integer=4 Const STCRemoteServer As integer=16 'Const STCRemoteServer As integer=16 Const STCAll As integer=23 'Const STCAll As integer=23
'================================================================================ Type SpeechTokenShellFolder As Integer ' '================================================================================ Const STSF_AppData As integer=26 'Const STSF_AppData As integer=26 Const STSF_LocalAppData As integer=28 'Const STSF_LocalAppData As integer=28 Const STSF_CommonAppData As integer=35 'Const STSF_CommonAppData As integer=35 Const STSF_FlagCreate As integer=32768 'Const STSF_FlagCreate As integer=32768
'================================================================================ Type SpeechAudioFormatType As Integer ' '================================================================================ Const SAFTDefault As integer=-1 'Const SAFTDefault As integer=-1 Const SAFTNoAssignedFormat As integer=0 'Const SAFTNoAssignedFormat As integer=0 Const SAFTText As integer=1 'Const SAFTText As integer=1 Const SAFTNonStandardFormat As integer=2 'Const SAFTNonStandardFormat As integer=2 Const SAFTExtendedAudioFormat As integer=3 'Const SAFTExtendedAudioFormat As integer=3 Const SAFT8kHz8BitMono As integer=4 'Const SAFT8kHz8BitMono As integer=4 Const SAFT8kHz8BitStereo As integer=5 'Const SAFT8kHz8BitStereo As integer=5 Const SAFT8kHz16BitMono As integer=6 'Const SAFT8kHz16BitMono As integer=6 Const SAFT8kHz16BitStereo As integer=7 'Const SAFT8kHz16BitStereo As integer=7 Const SAFT11kHz8BitMono As integer=8 'Const SAFT11kHz8BitMono As integer=8 Const SAFT11kHz8BitStereo As integer=9 'Const SAFT11kHz8BitStereo As integer=9 Const SAFT11kHz16BitMono As integer=10 'Const SAFT11kHz16BitMono As integer=10 Const SAFT11kHz16BitStereo As integer=11 'Const SAFT11kHz16BitStereo As integer=11 Const SAFT12kHz8BitMono As integer=12 'Const SAFT12kHz8BitMono As integer=12 Const SAFT12kHz8BitStereo As integer=13 'Const SAFT12kHz8BitStereo As integer=13 Const SAFT12kHz16BitMono As integer=14 'Const SAFT12kHz16BitMono As integer=14 Const SAFT12kHz16BitStereo As integer=15 'Const SAFT12kHz16BitStereo As integer=15 Const SAFT16kHz8BitMono As integer=16 'Const SAFT16kHz8BitMono As integer=16 Const SAFT16kHz8BitStereo As integer=17 'Const SAFT16kHz8BitStereo As integer=17 Const SAFT16kHz16BitMono As integer=18 'Const SAFT16kHz16BitMono As integer=18 Const SAFT16kHz16BitStereo As integer=19 'Const SAFT16kHz16BitStereo As integer=19 Const SAFT22kHz8BitMono As integer=20 'Const SAFT22kHz8BitMono As integer=20 Const SAFT22kHz8BitStereo As integer=21 'Const SAFT22kHz8BitStereo As integer=21 Const SAFT22kHz16BitMono As integer=22 'Const SAFT22kHz16BitMono As integer=22 Const SAFT22kHz16BitStereo As integer=23 'Const SAFT22kHz16BitStereo As integer=23 Const SAFT24kHz8BitMono As integer=24 'Const SAFT24kHz8BitMono As integer=24 Const SAFT24kHz8BitStereo As integer=25 'Const SAFT24kHz8BitStereo As integer=25 Const SAFT24kHz16BitMono As integer=26 'Const SAFT24kHz16BitMono As integer=26 Const SAFT24kHz16BitStereo As integer=27 'Const SAFT24kHz16BitStereo As integer=27 Const SAFT32kHz8BitMono As integer=28 'Const SAFT32kHz8BitMono As integer=28 Const SAFT32kHz8BitStereo As integer=29 'Const SAFT32kHz8BitStereo As integer=29 Const SAFT32kHz16BitMono As integer=30 'Const SAFT32kHz16BitMono As integer=30 Const SAFT32kHz16BitStereo As integer=31 'Const SAFT32kHz16BitStereo As integer=31 Const SAFT44kHz8BitMono As integer=32 'Const SAFT44kHz8BitMono As integer=32 Const SAFT44kHz8BitStereo As integer=33 'Const SAFT44kHz8BitStereo As integer=33 Const SAFT44kHz16BitMono As integer=34 'Const SAFT44kHz16BitMono As integer=34 Const SAFT44kHz16BitStereo As integer=35 'Const SAFT44kHz16BitStereo As integer=35 Const SAFT48kHz8BitMono As integer=36 'Const SAFT48kHz8BitMono As integer=36 Const SAFT48kHz8BitStereo As integer=37 'Const SAFT48kHz8BitStereo As integer=37 Const SAFT48kHz16BitMono As integer=38 'Const SAFT48kHz16BitMono As integer=38 Const SAFT48kHz16BitStereo As integer=39 'Const SAFT48kHz16BitStereo As integer=39 Const SAFTTrueSpeech_8kHz1BitMono As integer=40 'Const SAFTTrueSpeech_8kHz1BitMono As integer=40 Const SAFTCCITT_ALaw_8kHzMono As integer=41 'Const SAFTCCITT_ALaw_8kHzMono As integer=41 Const SAFTCCITT_ALaw_8kHzStereo As integer=42 'Const SAFTCCITT_ALaw_8kHzStereo As integer=42 Const SAFTCCITT_ALaw_11kHzMono As integer=43 'Const SAFTCCITT_ALaw_11kHzMono As integer=43 Const SAFTCCITT_ALaw_11kHzStereo As integer=44 'Const SAFTCCITT_ALaw_11kHzStereo As integer=44 Const SAFTCCITT_ALaw_22kHzMono As integer=45 'Const SAFTCCITT_ALaw_22kHzMono As integer=45 Const SAFTCCITT_ALaw_22kHzStereo As integer=46 'Const SAFTCCITT_ALaw_22kHzStereo As integer=46 Const SAFTCCITT_ALaw_44kHzMono As integer=47 'Const SAFTCCITT_ALaw_44kHzMono As integer=47 Const SAFTCCITT_ALaw_44kHzStereo As integer=48 'Const SAFTCCITT_ALaw_44kHzStereo As integer=48 Const SAFTCCITT_uLaw_8kHzMono As integer=49 'Const SAFTCCITT_uLaw_8kHzMono As integer=49 Const SAFTCCITT_uLaw_8kHzStereo As integer=50 'Const SAFTCCITT_uLaw_8kHzStereo As integer=50 Const SAFTCCITT_uLaw_11kHzMono As integer=51 'Const SAFTCCITT_uLaw_11kHzMono As integer=51 Const SAFTCCITT_uLaw_11kHzStereo As integer=52 'Const SAFTCCITT_uLaw_11kHzStereo As integer=52 Const SAFTCCITT_uLaw_22kHzMono As integer=53 'Const SAFTCCITT_uLaw_22kHzMono As integer=53 Const SAFTCCITT_uLaw_22kHzStereo As integer=54 'Const SAFTCCITT_uLaw_22kHzStereo As integer=54 Const SAFTCCITT_uLaw_44kHzMono As integer=55 'Const SAFTCCITT_uLaw_44kHzMono As integer=55 Const SAFTCCITT_uLaw_44kHzStereo As integer=56 'Const SAFTCCITT_uLaw_44kHzStereo As integer=56 Const SAFTADPCM_8kHzMono As integer=57 'Const SAFTADPCM_8kHzMono As integer=57 Const SAFTADPCM_8kHzStereo As integer=58 'Const SAFTADPCM_8kHzStereo As integer=58 Const SAFTADPCM_11kHzMono As integer=59 'Const SAFTADPCM_11kHzMono As integer=59 Const SAFTADPCM_11kHzStereo As integer=60 'Const SAFTADPCM_11kHzStereo As integer=60 Const SAFTADPCM_22kHzMono As integer=61 'Const SAFTADPCM_22kHzMono As integer=61 Const SAFTADPCM_22kHzStereo As integer=62 'Const SAFTADPCM_22kHzStereo As integer=62 Const SAFTADPCM_44kHzMono As integer=63 'Const SAFTADPCM_44kHzMono As integer=63 Const SAFTADPCM_44kHzStereo As integer=64 'Const SAFTADPCM_44kHzStereo As integer=64 Const SAFTGSM610_8kHzMono As integer=65 'Const SAFTGSM610_8kHzMono As integer=65 Const SAFTGSM610_11kHzMono As integer=66 'Const SAFTGSM610_11kHzMono As integer=66 Const SAFTGSM610_22kHzMono As integer=67 'Const SAFTGSM610_22kHzMono As integer=67 Const SAFTGSM610_44kHzMono As integer=68 'Const SAFTGSM610_44kHzMono As integer=68
'================================================================================ Type SpeechStreamSeekPositionType As Integer ' '================================================================================ Const SSSPTRelativeToStart As integer=0 'Const SSSPTRelativeToStart As integer=0 Const SSSPTRelativeToCurrentPosition As integer=1 'Const SSSPTRelativeToCurrentPosition As integer=1 Const SSSPTRelativeToEnd As integer=2 'Const SSSPTRelativeToEnd As integer=2
'================================================================================ Type SpeechRunState As Integer ' '================================================================================ Const SRSEDone As integer=1 'Const SRSEDone As integer=1 Const SRSEIsSpeaking As integer=2 'Const SRSEIsSpeaking As integer=2
'================================================================================ Type SpeechVoiceEvents As Integer ' '================================================================================ Const SVEStartInputStream As integer=2 'Const SVEStartInputStream As integer=2 Const SVEEndInputStream As integer=4 'Const SVEEndInputStream As integer=4 Const SVEVoiceChange As integer=8 'Const SVEVoiceChange As integer=8 Const SVEBookmark As integer=16 'Const SVEBookmark As integer=16 Const SVEWordBoundary As integer=32 'Const SVEWordBoundary As integer=32 Const SVEPhoneme As integer=64 'Const SVEPhoneme As integer=64 Const SVESentenceBoundary As integer=128 'Const SVESentenceBoundary As integer=128 Const SVEViseme As integer=256 'Const SVEViseme As integer=256 Const SVEAudioLevel As integer=512 'Const SVEAudioLevel As integer=512 Const SVEPrivate As integer=32768 'Const SVEPrivate As integer=32768 Const SVEAllEvents As integer=33790 'Const SVEAllEvents As integer=33790
'================================================================================ Type SpeechVoicePriority As Integer ' '================================================================================ Const SVPNormal As integer=0 'Const SVPNormal As integer=0 Const SVPAlert As integer=1 'Const SVPAlert As integer=1 Const SVPOver As integer=2 'Const SVPOver As integer=2
'================================================================================ Type SpeechVoiceSpeakFlags As Integer ' '================================================================================ Const SVSFDefault As integer=0 'Const SVSFDefault As integer=0 Const SVSFlagsAsync As integer=1 'Const SVSFlagsAsync As integer=1 Const SVSFPurgeBeforeSpeak As integer=2 'Const SVSFPurgeBeforeSpeak As integer=2 Const SVSFIsFilename As integer=4 'Const SVSFIsFilename As integer=4 Const SVSFIsXML As integer=8 'Const SVSFIsXML As integer=8 Const SVSFIsNotXML As integer=16 'Const SVSFIsNotXML As integer=16 Const SVSFPersistXML As integer=32 'Const SVSFPersistXML As integer=32 Const SVSFNLPSpeakPunc As integer=64 'Const SVSFNLPSpeakPunc As integer=64 Const SVSFNLPMask As integer=64 'Const SVSFNLPMask As integer=64 Const SVSFVoiceMask As integer=127 'Const SVSFVoiceMask As integer=127 Const SVSFUnusedFlags As integer=-128 'Const SVSFUnusedFlags As integer=-128
'================================================================================ 'CLSID - Microsoft Speech Object Library?{C866CA3A-32F7-11D2-9602-00C04F8EE628} '================================================================================ Const CLSID_SpNotifyTranslator="{E2AE5372-5D40-11D2-960E-00C04F8EE628}" 'SpNotify Const CLSID_SpObjectTokenCategory="{A910187F-0C7A-45AC-92CC-59EDAFB77B53}" 'SpObjectTokenCategory Class Const CLSID_SpObjectToken="{EF411752-3736-4CB4-9C8C-8EF4CCB58EFE}" 'SpObjectToken Class Const CLSID_SpResourceManager="{96749373-3391-11D2-9EE3-00C04F797396}" 'SpResourceManger Const CLSID_SpStreamFormatConverter="{7013943A-E2EC-11D2-A086-00C04F8EF9B5}" 'FormatConverter Class Const CLSID_SpMMAudioEnum="{AB1890A0-E91F-11D2-BB91-00C04F8EE6C0}" 'SpMMAudioEnum Class Const CLSID_SpMMAudioIn="{CF3D2E50-53F2-11D2-960C-00C04F8EE628}" 'SpMMAudioIn Class Const CLSID_SpMMAudioOut="{A8C680EB-3D32-11D2-9EE7-00C04F797396}" 'SpMMAudioOut Class Const CLSID_SpRecPlayAudio="{FEE225FC-7AFD-45E9-95D0-5A318079D911}" 'SpRecPlayAudio Class Const CLSID_SpStream="{715D9C59-4442-11D2-9605-00C04F8EE628}" 'SpStream Class Const CLSID_SpVoice="{96749377-3391-11D2-9EE3-00C04F797396}" 'SpVoice Class Const CLSID_SpSharedRecoContext="{47206204-5ECA-11D2-960F-00C04F8EE628}" 'SpSharedRecoContext Class Const CLSID_SpInprocRecognizer="{41B89B6B-9399-11D2-9623-00C04F8EE628}" 'SpInprocRecognizer Class Const CLSID_SpSharedRecognizer="{3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F}" 'SpSharedRecognizer Class Const CLSID_SpLexicon="{0655E396-25D0-11D3-9C26-00C04F8EF87C}" 'SpLexicon Class Const CLSID_SpUnCompressedLexicon="{C9E37C15-DF92-4727-85D6-72E5EEB6995A}" 'SpUnCompressedLexicon Class Const CLSID_SpCompressedLexicon="{90903716-2F42-11D3-9C26-00C04F8EF87C}" 'SpCompressedLexicon Class Const CLSID_SpPhoneConverter="{9185F743-1143-4C28-86B5-BFF14F20E5C8}" 'SpPhoneConverter Class Const CLSID_SpNullPhoneConverter="{455F24E9-7396-4A16-9715-7C0FDBE3EFE3}" 'SpNullPhoneConverter Class Const CLSID_SpTextSelectionInformation="{0F92030A-CBFD-4AB8-A164-FF5985547FF6}" 'SpTextSelectionInformation Class Const CLSID_SpPhraseInfoBuilder="{C23FC28D-C55F-4720-8B32-91F73C2BD5D1}" 'SpPhraseInfoBuilder Class Const CLSID_SpAudioFormat="{9EF96870-E160-4792-820D-48CF0649E4EC}" 'SpAudioFormat Class Const CLSID_SpWaveFormatEx="{C79A574C-63BE-44B9-801F-283F87F898BE}" 'SpWaveFormatEx Class Const CLSID_SpInProcRecoContext="{73AD6842-ACE0-45E8-A4DD-8795881A2C2A}" 'SpInProcRecoContext Class Const CLSID_SpCustomStream="{8DBEF13F-1948-4AA8-8CF0-048EEBED95D8}" 'SpCustomStream Class Const CLSID_SpFileStream="{947812B3-2AE1-4644-BA86-9E90DED7EC91}" 'SpFileStream Class Const CLSID_SpMemoryStream="{5FB7EF7D-DFF4-468A-B6B7-2FCBD188F994}" 'SpMemoryStream Class
'================================================================================ 'ProgID - Microsoft Speech Object Library?{C866CA3A-32F7-11D2-9602-00C04F8EE628} '================================================================================ Const ProgID_SpNotifyTranslator="SAPI.SpNotifyTranslator.1" Const ProgID_SpObjectTokenCategory="SAPI.SpObjectTokenCategory.1" Const ProgID_SpObjectToken="SAPI.SpObjectToken.1" Const ProgID_SpResourceManager="SAPI.SpResourceManager.1" Const ProgID_SpStreamFormatConverter="SAPI.SpStreamFormatConverter.1" Const ProgID_SpMMAudioEnum="SAPI.SpMMAudioEnum.1" Const ProgID_SpMMAudioIn="SAPI.SpMMAudioIn.1" Const ProgID_SpMMAudioOut="SAPI.SpMMAudioOut.1" Const ProgID_SpRecPlayAudio="SAPI.SpRecPlayAudio.1" Const ProgID_SpStream="SAPI.SpStream.1" Const ProgID_SpVoice="SAPI.SpVoice.1" Const ProgID_SpSharedRecoContext="SAPI.SpSharedRecoContext.1" Const ProgID_SpInprocRecognizer="Sapi.SpInprocRecognizer.1" Const ProgID_SpSharedRecognizer="Sapi.SpSharedRecognizer.1" Const ProgID_SpLexicon="SAPI.SpLexicon.1" Const ProgID_SpUnCompressedLexicon="SAPI.SpUncompressedLexicon.1" Const ProgID_SpCompressedLexicon="SAPI.SpCompressedLexicon.1" Const ProgID_SpPhoneConverter="SAPI.SpPhoneConverter.1" Const ProgID_SpNullPhoneConverter="SAPI.SpNullPhoneConverter.1" Const ProgID_SpTextSelectionInformation="SAPI.SpTextSelectionInformation.1" Const ProgID_SpPhraseInfoBuilder="SAPI.SpPhraseInfoBuilder.1" Const ProgID_SpAudioFormat="SAPI.SpAudioFormat.1" Const ProgID_SpWaveFormatEx="SAPI.SpWaveFormatEx.1" Const ProgID_SpInProcRecoContext="SAPI.SpInProcRecoContext.1" Const ProgID_SpCustomStream="SAPI.SpCustomStream.1" Const ProgID_SpFileStream="SAPI.SpFileStream.1" Const ProgID_SpMemoryStream="SAPI.SpMemoryStream.1"
'================================================================================ 'Alias Interface vTable - Microsoft Speech Object Library?{C866CA3A-32F7-11D2-9602-00C04F8EE628} '================================================================================ Type ISpeechDataKey As ISpeechDataKey_ Ptr Type ISpeechObjectToken As ISpeechObjectToken_ Ptr Type ISpeechObjectTokenCategory As ISpeechObjectTokenCategory_ Ptr Type ISpeechObjectTokens As ISpeechObjectTokens_ Ptr Type ISpeechAudioFormat As ISpeechAudioFormat_ Ptr Type ISpeechWaveFormatEx As ISpeechWaveFormatEx_ Ptr Type ISpeechBaseStream As ISpeechBaseStream_ Ptr Type ISpeechVoice As ISpeechVoice_ Ptr Type ISpeechVoiceStatus As ISpeechVoiceStatus_ Ptr
'================================================================================ 'vTable - Microsoft Speech Object Library?{C866CA3A-32F7-11D2-9602-00C04F8EE628} '================================================================================ '================================================================================ 'Interface ISpeechDataKey ?ISpeechDataKey Interface Const IID_ISpeechDataKey="{CE17C09B-4EFA-44D5-A4C9-59D9585AB0CD}" '================================================================================ Type ISpeechDataKeyvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT SetBinaryValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As VARIANT) As HRESULT 'SetBinaryValue GetBinaryValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As VARIANT Ptr) As HRESULT 'GetBinaryValue SetStringValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As BSTR) As HRESULT 'SetStringValue GetStringValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As BSTR Ptr) As HRESULT 'GetStringValue SetLongValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As long) As HRESULT 'SetLongValue GetLongValue As Function(pThis As Any Ptr,ValueName As BSTR,Value As long Ptr) As HRESULT 'GetlongValue OpenKey As Function(pThis As Any Ptr,SubKeyName As BSTR,SubKey As ISpeechDataKey Ptr Ptr) As HRESULT 'OpenKey CreateKey As Function(pThis As Any Ptr,SubKeyName As BSTR,SubKey As ISpeechDataKey Ptr Ptr) As HRESULT 'CreateKey DeleteKey As Function(pThis As Any Ptr,SubKeyName As BSTR) As HRESULT 'DeleteKey DeleteValue As Function(pThis As Any Ptr,ValueName As BSTR) As HRESULT 'DeleteValue EnumKeys As Function(pThis As Any Ptr,Index As long,SubKeyName As BSTR Ptr) As HRESULT 'EnumKeys EnumValues As Function(pThis As Any Ptr,Index As long,ValueName As BSTR Ptr) As HRESULT 'EnumValues End Type
Type ISpeechDataKey_ lpvtbl As ISpeechDataKeyvTbl Ptr End Type
'================================================================================ 'Interface ISpeechObjectToken ?ISpeechObjectToken Interface Const IID_ISpeechObjectToken="{C74A3ADC-B727-4500-A84A-B526721C8B8C}" '================================================================================ Type ISpeechObjectTokenvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any Ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getId As Function(pThis As Any Ptr,ObjectId As BSTR Ptr) As HRESULT 'Id getDataKey As Function(pThis As Any Ptr,DataKey As ISpeechDataKey Ptr Ptr) As HRESULT 'DataKey getCategory As Function(pThis As Any Ptr,Category As ISpeechObjectTokenCategory Ptr Ptr) As HRESULT 'Category GetDescription As Function(pThis As Any Ptr,Locale As long=0,Description As BSTR Ptr) As HRESULT 'GetDescription SetId As Function(pThis As Any Ptr,Id As BSTR,CategoryID As BSTR=0,CreateIfNotExist As long=0) As HRESULT 'SetId GetAttribute As Function(pThis As Any Ptr,AttributeName As BSTR,AttributeValue As BSTR Ptr) As HRESULT 'GetAttribute CreateInstance As Function(pThis As Any Ptr,pUnkOuter As lpUnknown=0,ClsContext As SpeechTokenContext=23,Object As lpUnknown Ptr) As HRESULT 'CreateInstance Remove As Function(pThis As Any Ptr,ObjectStorageCLSID As BSTR) As HRESULT 'Remove GetStorageFileName As Function(pThis As Any Ptr,ObjectStorageCLSID As BSTR,KeyName As BSTR,FileName As BSTR,Folder As SpeechTokenShellFolder,FilePath As BSTR Ptr) As HRESULT 'GetStorageFileName RemoveStorageFileName As Function(pThis As Any Ptr,ObjectStorageCLSID As BSTR,KeyName As BSTR,DeleteFile As long) As HRESULT 'RemoveStorageFileName IsUISupported As Function(pThis As Any Ptr,TypeOfUI As BSTR,ExtraData As VARIANT Ptr=0,Object As lpUnknown=0,Supported As long Ptr) As HRESULT 'IsUISupported DisplayUI As Function(pThis As Any Ptr,hWnd As long,Title As BSTR,TypeOfUI As BSTR,ExtraData As VARIANT Ptr=0,Object As lpUnknown=0) As HRESULT 'DisplayUI MatchesAttributes As Function(pThis As Any Ptr,Attributes As BSTR,Matches As long Ptr) As HRESULT 'MatchesAttributes End Type
Type ISpeechObjectToken_ lpvtbl As ISpeechObjectTokenvTbl Ptr End Type
'================================================================================ 'Interface ISpeechObjectTokenCategory ?ISpeechObjectTokenCategory Interface Const IID_ISpeechObjectTokenCategory="{CA7EAC50-2D01-4145-86D4-5AE7D70F4469}" '================================================================================ Type ISpeechObjectTokenCategoryvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getId As Function(pThis As Any Ptr,Id As BSTR Ptr) As HRESULT 'Id putDefault As Function(pThis As Any Ptr,TokenId As BSTR) As HRESULT 'Default getDefault As Function(pThis As Any Ptr,TokenId As BSTR Ptr) As HRESULT 'Default SetId As Function(pThis As Any Ptr,Id As BSTR,CreateIfNotExist As long=0) As HRESULT 'SetId GetDataKey As Function(pThis As Any Ptr,Location As SpeechDataKeyLocation=0,DataKey As ISpeechDataKey Ptr Ptr) As HRESULT 'GetDataKey EnumerateTokens As Function(pThis As Any Ptr,RequiredAttributes As BSTR=0,OptionalAttributes As BSTR=0,Tokens As ISpeechObjectTokens Ptr Ptr) As HRESULT 'EnumerateTokens End Type
Type ISpeechObjectTokenCategory_ lpvtbl As ISpeechObjectTokenCategoryvTbl Ptr End Type
'================================================================================ 'Interface ISpeechObjectTokens ?ISpeechObjectTokens Interface Const IID_ISpeechObjectTokens="{9285B776-2E7B-4BC0-B53E-580EB6FA967F}" '================================================================================ Type ISpeechObjectTokensvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getCount As Function(pThis As Any Ptr,Count As long Ptr) As HRESULT 'Count Item As Function(pThis As Any Ptr,Index As long,Token As ISpeechObjectToken Ptr Ptr) As HRESULT 'Item get_NewEnum As Function(pThis As Any Ptr,ppEnumVARIANT As lpUnknown Ptr) As HRESULT 'Enumerates the tokens End Type
Type ISpeechObjectTokens_ lpvtbl As ISpeechObjectTokensvTbl Ptr End Type
'================================================================================ 'Interface ISpeechAudioFormat ?ISpeechAudioFormat Interface Const IID_ISpeechAudioFormat="{E6E9C590-3E18-40E3-8299-061F98BDE7C7}" '================================================================================ Type ISpeechAudioFormatvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getType As Function(pThis As Any Ptr,AudioFormat As SpeechAudioFormatType Ptr) As HRESULT 'Type putType As Function(pThis As Any Ptr,AudioFormat As SpeechAudioFormatType) As HRESULT 'Type getGuid As Function(pThis As Any Ptr,Guid As BSTR Ptr) As HRESULT 'Guid putGuid As Function(pThis As Any Ptr,Guid As BSTR) As HRESULT 'Guid GetWaveFormatEx As Function(pThis As Any Ptr,WaveFormatEx As ISpeechWaveFormatEx Ptr Ptr) As HRESULT 'GetWaveFormatEx SetWaveFormatEx As Function(pThis As Any Ptr,WaveFormatEx As ISpeechWaveFormatEx Ptr) As HRESULT 'SetWaveFormatEx End Type
Type ISpeechAudioFormat_ lpvtbl As ISpeechAudioFormatvTbl Ptr End Type
'================================================================================ 'Interface ISpeechWaveFormatEx ?ISpeechWaveFormatEx Interface Const IID_ISpeechWaveFormatEx="{7A1EF0D5-1581-4741-88E4-209A49F11A10}" '================================================================================ Type ISpeechWaveFormatExvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getFormatTag As Function(pThis As Any Ptr,FormatTag As short Ptr) As HRESULT 'FormatTag putFormatTag As Function(pThis As Any Ptr,FormatTag As short) As HRESULT 'FormatTag getChannels As Function(pThis As Any Ptr,Channels As short Ptr) As HRESULT 'Channels putChannels As Function(pThis As Any Ptr,Channels As short) As HRESULT 'Channels getSamplesPerSec As Function(pThis As Any Ptr,SamplesPerSec As long Ptr) As HRESULT 'SamplesPerSec putSamplesPerSec As Function(pThis As Any Ptr,SamplesPerSec As long) As HRESULT 'SamplesPerSec getAvgBytesPerSec As Function(pThis As Any Ptr,AvgBytesPerSec As long Ptr) As HRESULT 'AvgBytesPerSec putAvgBytesPerSec As Function(pThis As Any Ptr,AvgBytesPerSec As long) As HRESULT 'AvgBytesPerSec getBlockAlign As Function(pThis As Any Ptr,BlockAlign As short Ptr) As HRESULT 'BlockAlign putBlockAlign As Function(pThis As Any Ptr,BlockAlign As short) As HRESULT 'BlockAlign getBitsPerSample As Function(pThis As Any Ptr,BitsPerSample As short Ptr) As HRESULT 'BitsPerSample putBitsPerSample As Function(pThis As Any Ptr,BitsPerSample As short) As HRESULT 'BitsPerSample getExtraData As Function(pThis As Any Ptr,ExtraData As VARIANT Ptr) As HRESULT 'ExtraData putExtraData As Function(pThis As Any Ptr,ExtraData As VARIANT) As HRESULT 'ExtraData End Type
Type ISpeechWaveFormatEx_ lpvtbl As ISpeechWaveFormatExvTbl Ptr End Type
'================================================================================ 'Interface ISpeechBaseStream ?ISpeechBaseStream Interface Const IID_ISpeechBaseStream="{6450336F-7D49-4CED-8097-49D6DEE37294}" '================================================================================ Type ISpeechBaseStreamvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getFormat As Function(pThis As Any Ptr,AudioFormat As ISpeechAudioFormat Ptr Ptr) As HRESULT 'Format setFormat As Function(pThis As Any Ptr,AudioFormat As ISpeechAudioFormat Ptr) As HRESULT 'Format Read As Function(pThis As Any Ptr,Buffer As VARIANT Ptr,NumberOfBytes As long,BytesRead As long Ptr) As HRESULT 'Read Write As Function(pThis As Any Ptr,Buffer As VARIANT,BytesWritten As long Ptr) As HRESULT 'Write Seek As Function(pThis As Any Ptr,Position As VARIANT,Origin As SpeechStreamSeekPositionType=0,NewPosition As VARIANT Ptr) As HRESULT 'Seek End Type
Type ISpeechBaseStream_ lpvtbl As ISpeechBaseStreamvTbl Ptr End Type
'================================================================================ 'Interface ISpeechVoice ?ISpeechVoice Interface Const IID_ISpeechVoice="{269316D8-57BD-11D2-9EEE-00C04F797396}" '================================================================================ Type ISpeechVoicevTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getStatus As Function(pThis As Any Ptr,Status As ISpeechVoiceStatus Ptr Ptr) As HRESULT 'Status getVoice As Function(pThis As Any Ptr,Voice As ISpeechObjectToken Ptr Ptr) As HRESULT 'Voice setVoice As Function(pThis As Any Ptr,Voice As ISpeechObjectToken Ptr) As HRESULT 'Voice getAudioOutput As Function(pThis As Any Ptr,AudioOutput As ISpeechObjectToken Ptr Ptr) As HRESULT 'Gets the audio output object setAudioOutput As Function(pThis As Any Ptr,AudioOutput As ISpeechObjectToken Ptr) As HRESULT 'Gets the audio output object getAudioOutputStream As Function(pThis As Any Ptr,AudioOutputStream As ISpeechBaseStream Ptr Ptr) As HRESULT 'Gets the audio output stream setAudioOutputStream As Function(pThis As Any Ptr,AudioOutputStream As ISpeechBaseStream Ptr) As HRESULT 'Gets the audio output stream getRate As Function(pThis As Any Ptr,Rate As long Ptr) As HRESULT 'Rate putRate As Function(pThis As Any Ptr,Rate As long) As HRESULT 'Rate getVolume As Function(pThis As Any Ptr,Volume As long Ptr) As HRESULT 'Volume putVolume As Function(pThis As Any Ptr,Volume As long) As HRESULT 'Volume putAllowAudioOutputFormatChangesOnNextSet As Function(pThis As Any Ptr,Allow As long) As HRESULT 'AllowAudioOutputFormatChangesOnNextSet getAllowAudioOutputFormatChangesOnNextSet As Function(pThis As Any Ptr,Allow As long Ptr) As HRESULT 'AllowAudioOutputFormatChangesOnNextSet getEventInterests As Function(pThis As Any Ptr,EventInterestFlags As SpeechVoiceEvents Ptr) As HRESULT 'EventInterests putEventInterests As Function(pThis As Any Ptr,EventInterestFlags As SpeechVoiceEvents) As HRESULT 'EventInterests putPriority As Function(pThis As Any Ptr,Priority As SpeechVoicePriority) As HRESULT 'Priority getPriority As Function(pThis As Any Ptr,Priority As SpeechVoicePriority Ptr) As HRESULT 'Priority putAlertBoundary As Function(pThis As Any Ptr,Boundary As SpeechVoiceEvents) As HRESULT 'AlertBoundary getAlertBoundary As Function(pThis As Any Ptr,Boundary As SpeechVoiceEvents Ptr) As HRESULT 'AlertBoundary putSynchronousSpeakTimeout As Function(pThis As Any Ptr,msTimeout As long) As HRESULT 'SyncSpeakTimeout getSynchronousSpeakTimeout As Function(pThis As Any Ptr,msTimeout As long Ptr) As HRESULT 'SyncSpeakTimeout Speak As Function(pThis As Any Ptr,Text As BSTR,Flags As SpeechVoiceSpeakFlags=0,StreamNumber As long Ptr) As HRESULT 'Speak SpeakStream As Function(pThis As Any Ptr,Stream As ISpeechBaseStream Ptr,Flags As SpeechVoiceSpeakFlags=0,StreamNumber As long Ptr) As HRESULT 'SpeakStream Pause As Function(pThis As Any Ptr) As HRESULT 'Pauses the voices rendering. Resume As Function(pThis As Any Ptr) As HRESULT 'Resumes the voices rendering. Skip As Function(pThis As Any Ptr,Type As BSTR,NumItems As long,NumSkipped As long Ptr) As HRESULT 'Skips rendering the specified number of items. GetVoices As Function(pThis As Any Ptr,RequiredAttributes As BSTR=0,OptionalAttributes As BSTR=0,ObjectTokens As ISpeechObjectTokens Ptr Ptr) As HRESULT 'GetVoices GetAudioOutputs As Function(pThis As Any Ptr,RequiredAttributes As BSTR=0,OptionalAttributes As BSTR=0,ObjectTokens As ISpeechObjectTokens Ptr Ptr) As HRESULT 'GetAudioOutputs WaitUntilDone As Function(pThis As Any Ptr,msTimeout As long,Done As long Ptr) As HRESULT 'WaitUntilDone SpeakCompleteEvent As Function(pThis As Any Ptr,Handle As long Ptr) As HRESULT 'SpeakCompleteEvent IsUISupported As Function(pThis As Any Ptr,TypeOfUI As BSTR,ExtraData As VARIANT Ptr=0,Supported As long Ptr) As HRESULT 'IsUISupported DisplayUI As Function(pThis As Any Ptr,hWndParent As long,Title As BSTR,TypeOfUI As BSTR,ExtraData As VARIANT Ptr=0) As HRESULT 'DisplayUI End Type
Type ISpeechVoice_ lpvtbl As ISpeechVoicevTbl Ptr End Type
'================================================================================ 'Interface ISpeechVoiceStatus ?ISpeechVoiceStatus Interface Const IID_ISpeechVoiceStatus="{8BE47B07-57F6-11D2-9EEE-00C04F797396}" '================================================================================ Type ISpeechVoiceStatusvTbl QueryInterface As Function (pThis As Any ptr,riid As GUID ptr,ppvObj As Any ptr) As hResult AddRef As Function (pThis As Any ptr) As hResult Release As Function (pThis As Any ptr) As hResult GetTypeInfoCount As Function(pThis As Any Ptr,pctinfo As UINT Ptr) As HRESULT GetTypeInfo As Function(pThis As Any Ptr,itinfo As UINT,lcid As ULONG,pptinfo As lpvoid Ptr) As HRESULT GetIDsOfNames As Function(pThis As Any Ptr,riid As GUID Ptr,rgszNames As BYTE Ptr Ptr,cNames As UINT,lcid As ULONG,rgdispid As long Ptr) As HRESULT Invoke As Function(pThis As Any Ptr,dispidMember As long,riid As GUID Ptr,lcid As ULONG,wFlags As USHORT,pdispparams As DISPPARAMS Ptr,pvarResult As VARIANT Ptr,pexcepinfo As EXCEPINFO Ptr,puArgErr As UINT Ptr) As HRESULT getCurrentStreamNumber As Function(pThis As Any Ptr,StreamNumber As long Ptr) As HRESULT 'CurrentStreamNumber getLastStreamNumberQueued As Function(pThis As Any Ptr,StreamNumber As long Ptr) As HRESULT 'LastStreamNumberQueued getLastHResult As Function(pThis As Any Ptr,HResult As long Ptr) As HRESULT 'LastHResult getRunningState As Function(pThis As Any Ptr,State As SpeechRunState Ptr) As HRESULT 'RunningState getInputWordPosition As Function(pThis As Any Ptr,Position As long Ptr) As HRESULT 'InputWordPosition getInputWordLength As Function(pThis As Any Ptr,Length As long Ptr) As HRESULT 'InputWordLength getInputSentencePosition As Function(pThis As Any Ptr,Position As long Ptr) As HRESULT 'InputSentencePosition getInputSentenceLength As Function(pThis As Any Ptr,Length As long Ptr) As HRESULT 'InputSentenceLength getLastBookmark As Function(pThis As Any Ptr,Bookmark As BSTR Ptr) As HRESULT 'LastBookmark getLastBookmarkId As Function(pThis As Any Ptr,BookmarkId As long Ptr) As HRESULT 'LastBookmarkId getPhonemeId As Function(pThis As Any Ptr,PhoneId As short Ptr) As HRESULT 'PhonemeId getVisemeId As Function(pThis As Any Ptr,VisemeId As short Ptr) As HRESULT 'VisemeId End Type
Type ISpeechVoiceStatus_ lpvtbl As ISpeechVoiceStatusvTbl Ptr End Type
code de say.rc : - Code:
-
#define IDD_DLG1 1000 #define IDC_EDT1 1001 #define IDC_BTN1 1002 #define IDC_CBO1 1003
IDD_DLG1 DIALOGEX 6,5,176,147 CAPTION "IDD_DLG" FONT 8,"MS Sans Serif",0,0,0 STYLE 0x10CF0800 BEGIN CONTROL "",IDC_EDT1,"Edit",0x50211044,0,14,176,131,0x00000200 CONTROL "SAY",IDC_BTN1,"Button",0x50010000,148,0,26,13 CONTROL "",IDC_CBO1,"ComboBox",0x50010003,0,0,146,63 END
et enfin, code de say.bas : - Code:
-
'================================================ 'Code generated by RC2CODE - RC To Code Generator 'Very first stage project, use at your own risk 'Contact Loe at webhasta[at]telkom.net '================================================
#include once "windows.bi" '#include once "C:\FbEdit\Projects\sayv\say.bi" 'exported names of resource file '========================================================================= 'Include file of control '========================================================================= #Include "axobj.bi" #Include "sapi.bi"
'========================================================================= 'Defined constant in .rc file. 'Please delete this section if you have included exported names of resource. '========================================================================= #define IDD_DLG1 1000 #define IDC_EDT1 1001 #define IDC_BTN1 1002 #define IDC_CBO1 1003
'========================================================================= 'Global variable '========================================================================= Dim Shared spvoice As ISpeechVoice Dim Shared tokens As ISpeechObjectTokens Dim Shared token As ISpeechObjectToken
'========================================================================= 'Dialog callback procedure declaration '========================================================================= declare Function IDD_DLG1_DlgProc(byval hWin as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM) as integer
'========================================================================= 'Initial code of control '========================================================================= axinit DialogBoxParam(GetModuleHandle(NULL), Cast(zstring ptr,IDD_DLG1), NULL, @IDD_DLG1_DlgProc, NULL) ExitProcess(0) end
'========================================================================= 'Sample procedure of control '========================================================================= sub IDD_DLG1_IDC_CBO1_Sample(byval hWin as hwnd) dim hIDC_CBO1 as hwnd Dim As long i,n Dim desc As bstr Dim text As String 'Fill ComboBox tokens->lpvtbl->getCount (tokens,@n) hIDC_CBO1=getdlgitem(hWin,IDC_CBO1) For i=0 To n-1 tokens->lpvtbl->Item (tokens,i,@token) token->lpvtbl->GetDescription (token,0,@desc) text=*Cast(WString Ptr,desc) SendMessage hIDC_CBO1,CB_ADDSTRING,0,StrPtr(text) token->lpvtbl->Release (token) Next End sub
'========================================================================= 'Event Generated of Control '========================================================================= Function IDD_DLG1_Init _ (Byval hWin as hwnd,_ Byval wParam as wParam,_ Byval lParam as lParam _ )as Integer axcreateobject(ProgID_SpVoice,spvoice) If axscode Then messagebox(0,scodes(axscode),"scode",0):enddialog(hwin,0) spvoice->lpvtbl->GetVoices (spvoice,0,0,@tokens) IDD_DLG1_IDC_CBO1_Sample(hWin) End Function
Function IDD_DLG1_OnSize _ (Byval hWin as hwnd,_ 'handle of dialog Byval lState as long,_ 'resizing state Byval cx as long,_ 'width of client area Byval cy as long _ 'height of client area )as Integer movewindow getdlgitem(hwin,idc_edt1),0,22,cx,cy-22,true End Function Function IDD_DLG1_OnClose _ (Byval hWin as hwnd _ 'handle of dialog )as Integer If tokens Then tokens->lpvtbl->Release (tokens) If spvoice Then spvoice->lpvtbl->Release(spvoice) End Function Function IDD_DLG1_OnDestroy _ (Byval hWin as hwnd _ 'handle of dialog )as Integer End Function Function IDD_DLG1_OnNotify _ (Byval hWin as hwnd,_ 'handle of dialog Byval lCtlID as long,_ 'resizing state Byval lpNMHDR as NMHDR ptr,_ 'width of client area Byref lresult as long _ 'return value )as Integer End Function Function IDD_DLG1_OnTimer _ (Byval hWin as hwnd,_ 'handle of dialog Byval wTimerID as word _ 'handle of dialog )as Integer End Function function IDD_DLG1_IDC_BTN1_Clicked _ (Byval hWin as hwnd,_ 'Handle of dialog Byval hCtrl as hwnd _ 'Handle of control )as Long Dim text As ZString*65536 Dim As Boolean vbool Dim As long dw sendmessage getdlgitem(hwin,idc_edt1),wm_gettext,65535,@text spvoice->lpvtbl->Speak (spvoice,stringtobstr(text),dw,dw) spvoice->lpvtbl->WaitUntilDone (spvoice,-1,-1) end function Function IDD_DLG1_IDC_CBO1_SelChange _ (byval hWin as hwnd,_ 'handle of dialog byval lpNMHDR as NMHDR ptr,_ Byref lresult as long _ 'return value )as long dim as zstring*64 cbtext,text dim desc as bstr Dim As Long i,n
SendMessage GetDlgItem(hWin,IDC_CBO1),WM_GETTEXT,64,@cbtext tokens->lpvtbl->getCount (tokens,@n) For i=0 To n-1 tokens->lpvtbl->Item(tokens,i,@token) token->lpvtbl->GetDescription(token,0,@desc) text=*Cast(WString Ptr,desc) If text=cbtext Then spvoice->lpvtbl->setVoice(spvoice,token) messagebox(0,"Voice changed to "+text,"Alert",0) EndIf token->lpvtbl->Release(token) Next End function
'========================================================================= 'Dialog callback procedure '========================================================================= Function IDD_DLG1_DlgProc(byval hWin as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM) as integer dim as long id,event,lresult 'dim hCtl as HWND dim rect as RECT dim lpNMHDR as NMHDR ptr
select case uMsg case WM_INITDIALOG if IDD_DLG1_Init(hWin,wparam,lparam) then function=false exit function endif case WM_COMMAND id=loword(wParam) event=hiword(wParam) select case id case IDC_BTN1 if event = BN_CLICKED THEN if IDD_DLG1_IDC_BTN1_Clicked(hWin,lparam) then function=false exit function endif endif case IDC_CBO1 if event=CBN_SELCHANGE then if IDD_DLG1_IDC_CBO1_SelChange(hWin,lpNMHDR,lresult) then function=lresult exit function endif endif end select
case WM_SIZE if IDD_DLG1_OnSize(hWin,wparam,loword(lparam),hiword(lparam)) then function=false exit function endif case WM_NOTIFY lpNMHDR=lparam id=lpnmhdr->idfrom event=lpnmhdr->code
if IDD_DLG1_OnNotify(hWin,wparam,lparam,lresult) then function=lresult exit function endif case WM_TIMER if IDD_DLG1_OnTimer(hWin,wparam) then function=false exit function endif case WM_CLOSE if IDD_DLG1_OnClose(hWin) then function=false exit function endif EndDialog(hWin,0) case WM_DESTROY
IDD_DLG1_OnDestroy(hWin) function=false exit function case else return FALSE end select return TRUE End Function
| |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Mer 11 Mai 2011 - 13:58 | |
| J'espère que ça permettra à ceux qui maitrise ces langage de m'expliquer comment je peux utiliser la synthès vocale dans Panoramic (à priori, ça m'a l'air faisable). | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Jeu 12 Mai 2011 - 13:36 | |
| En VB6, pour utiliser SAPI4, il faut faire: - Code:
-
Si VB6 dans le fichier projet ajouter la référence
Reference=*\G{EEE78583-FE22-11D0-8BEF-0060081841DE}#1.0#0#C:\speech\Xvoice.dll#Microsoft Direct Speech Synthesis
Private Sub Form_Load()
Const SPF_ASYNC = 1 Const SPF_DEFAULT = 0 Const SPF_IS_FILENAME = 4 Const SPF_IS_NOT_XML = 16 Const SPF_IS_XML = 8 Const SPF_NLP_MASK = 64 Const SPF_NLP_SPEAK_PUNC = 64 Const SPF_PERSIST_XML = 32 Const SPF_PURGEBEFORESPEAK = 2 Const SPF_UNUSED_FLAGS = -128 Const SPF_VOICE_MASK = 127
Dim ISpeechVoice as Object Set ISpeechVoice = CreateObject("SAPI.SpVoice") Call ISpeechVoice.Speak(TextString, SPF_DEFAULT)
ISpeechVoice.Speak("Je vous parle", SPF_DEFAULT) "You've got 20 new messages." End Sub
Quelqu'un saurait-il faire l'équivalent en Panoramic ? | |
| | | Jack Admin
Nombre de messages : 2394 Date d'inscription : 28/05/2007
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Ven 13 Mai 2011 - 7:42 | |
| Pour faire cela en Visual Basic: - Citation :
- Set ISpeechVoice = CreateObject("SAPI.SpVoice")
il faut qu'un objet SAPI soit déjà installé et qu'un controle ActiveX soit aussi installé dans l'ordinateur. Faire des appels directs à une DLL ne suffit pas. Un controle ActiveX doit avoir été installé et il faut un dialogue OLE avec ce controle. Avec PANORAMIC, il y aurait 2 solutions: - que je crée un nouvel objet, par exemple SPEECH qui répondrait à des commandes de type PLAY- que je crée des nouvelles commandes qui dialoguent directement avec le controle ActiveX, comme le font actuellement les commandes pour EXCEL: SPEECH_START SPEECH_TALK SPEECH_STOPTout cela serait réalisable d'ici quelques semaines, mais il y a tant à faire dans d'autres domaines ! Si cela intéresse d'autres personnes, je m'y colle, car c'est une bonne idée que de donner à PANORAMIC des possibilités de synthèse de la parole. | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Ven 13 Mai 2011 - 10:54 | |
| Merci Jack pour ta réponse, si tu as le temps, je suis preneur, je pense que ça ouvrirait des portes à pas mal d'applis ou de jeux (sans parler d'augmenter l'accessibilité aux mal-voyants, mais même si ce n'est pas la population la plus importante des utilisateurs, c'est toujours bien de prévoir des applis le plus accessible possible).
Bon courage
| |
| | | Yannick
Nombre de messages : 8635 Age : 53 Localisation : Bretagne Date d'inscription : 15/02/2010
| Sujet: re Ven 13 Mai 2011 - 13:47 | |
| L'idée est plaisante mais est elle prioritaire ? Je ne sais pas où Jack en est des 3 millions d'idées de la todo list. | |
| | | Jicehel
Nombre de messages : 5947 Age : 52 Localisation : 77500 Date d'inscription : 18/04/2011
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale Ven 13 Mai 2011 - 20:53 | |
| A la base, je pensais que l'on pouvait directement utiliser la DLL. Maintenant, c'est Jack qui voit pour mettre en place les instructions s'il veut. Moi je suis pour, bien sûr, car je pense que c'est pratique mais c'est lui qui verra en fonction du temps que ça demande et des priorités qu'il se fixe. J'ai mis les sources pour les personnes qui savent faire des DLL en free basic mais ça pour le moment, moi, je ne sais pas faire. Pour le moment, je met en standby et je passe à autre chose | |
| | | jjn4
Nombre de messages : 2747 Date d'inscription : 13/09/2009
| Sujet: +++ Ven 13 Mai 2011 - 23:57 | |
| C'est vrai que ce serait sympa, ça me rapelle que j'avais ça, il y a longtemps, quand j'étais sur Amstrad, mais là, ça a l'air quand même plus compliqué. En tout cas, ça permettrait de faire des programmes assez extraordinaires ! (enfin, si ça ne cause pas avec l'accent anglais !) | |
| | | Contenu sponsorisé
| Sujet: Re: utilisation de SAPI 4 pour la synthèse vocale | |
| |
| | | | utilisation de SAPI 4 pour la synthèse vocale | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |