Here’s what i have currently as far as TTS (Text To Speech) goes, someone on the FB Windows forum wrote the code for Windows.
I got it from the FB forum / Tips&Tricks section…
I’d like to port it to Linux…
you just create a string and call Speak(string)
#include once “windows.bi”
#include once “win/winnt.bi”
#include once “win/objbase.bi”
#inclib “ole32”
Dim shared IID_ISpVoice As GUID => ( &H6c44df74, &H72b9, &H4992, {&Ha1, &Hec, &Hef, &H99, &H6e, &H04, &H22, &Hd4 })
Dim shared CLSID_SpVoice As GUID => ( &H96749377, &H3391, &H11d2, {&H9e, &He3, &H00, &Hc0, &H4f, &H79, &H73, &H96 })
Type ISpVoiceVtbl_ As ISpVoiceVtbl
Type ISpVoice
lpVtbl As ISpVoiceVtbl_ Ptr
End Type
#define SPF_DEFAULT 0
Type ISpVoiceVtbl
rem 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
rem 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
rem done
Pause As Function(Byval As ISpVoice Ptr) As HRESULT
Resume As Function(Byval As ISpVoice Ptr) As HRESULT
rem stubs
SetVoice As Function() As HRESULT
GetVoice As Function() As HRESULT
rem done
Speak As Function(Byval As ISpVoice Ptr, Byval pwcs As Wstring Ptr, Byval dwFlags As DWORD, Byval pulStreamNumber As ULONG Ptr) As HRESULT
rem stubs
SpeakStream As Function() As HRESULT
GetStatus As Function() As HRESULT
Skip As Function() As HRESULT
SetPriority As Function() As HRESULT
GetPriority As Function() As HRESULT
SetAlertBoundary As Function() As HRESULT
GetAlertBoundary As Function() As HRESULT
rem 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
rem stubs
SetSyncSpeakTimeout As Function() As HRESULT
GetSyncSpeakTimeout As Function() As HRESULT
SpeakCompleteEvent As Function() As HRESULT
IsUISupported As Function() As HRESULT
DisplayUI As Function() As HRESULT
End Type
sub Speak ( byref tstring as string, byval rate as integer = 0 )
Dim voices As ISpVoice Ptr
CoInitialize(NULL)
CoCreateInstance(@CLSID_SpVoice, NULL, CLSCTX_ALL, @IID_ISpVoice, Cast (Any Ptr, @voices))
voices->lpVtbl->SetRate(voices, rate)
voices->lpVtbl->Speak(voices, tString, 1, NULL)
voices->lpVtbl->WaitUntilDone(voices, INFINITE)
voices->lpVtbl->Release(voices)
CoUninitialize()
end sub
sub Speak_No_Rate ( byval param as any ptr )
dim as zstring ptr tstring = Cast(zstring ptr, param)
? tstring
Dim voices As ISpVoice Ptr
CoInitialize(NULL)
CoCreateInstance(@CLSID_SpVoice, NULL, CLSCTX_ALL, @IID_ISpVoice, Cast (Any Ptr, @voices))
voices->lpVtbl->SetRate(voices, -2)
voices->lpVtbl->Speak(voices, *tString, SPF_DEFAULT, NULL)
voices->lpVtbl->WaitUntilDone(voices, INFINITE)
voices->lpVtbl->Release(voices)
CoUninitialize()
end sub
'===============================================================================