MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

MBS Real Studio Plugin Tutorial Videos

Speech Synthesizer Source

Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
ControlInstance
Sub Change() Handles Event
if me.ListIndex>=0 then
dim id as string

id=me.CellTag(me.ListIndex,0)

if Speech.setVoice(id) then
if speech.startSpeakingString(me.cell(me.ListIndex,1)) then
// OK
end if
end if

end if
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
call speech.startSpeakingString(EditField1.text)
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim file as FolderItem

file=GetSaveFolderItem("","test.aif")

if file<>Nil then
call speech.startSpeakingString(EditField1.text,file)
end if

End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
Speech.stopSpeaking
End Sub
End ControlInstance
ControlInstance
End ControlInstance

// Properties
Dim speech As NSSpeechSynthesizerMBS

// Event implementations
Sub Open()
Speech=new NSSpeechSynthesizerMBS

dim index,count as integer
dim voice as NSVoiceMBS
dim id as string

count=speech.availableVoicesCount

for index=0 to count-1

id=speech.availableVoice(index)
voice=Speech.attributesForVoice(id)

listbox1.AddRow voice.name
listbox1.CellTag(listbox1.LastIndex,0)=id
listbox1.cell(listbox1.LastIndex,1)=voice.DemoText

next

End Sub
End Class


All movies




Links
MBS Xojo blog