Platforms to show: All Mac Windows Linux Cross-Platform
/MacClassic/Speech/Speech recorder
Required plugins for this example: MBS Main Plugin, MBS Util Plugin, MBS MacCocoa Plugin
Last modified Sun, 17th Mar 2012.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacClassic/Speech/Speech recorder
Download this example: Speech recorder.zip
Project "Speech recorder.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim file as FolderItem
dim s as string
s=ReplaceLineEndings(EditField1.text," ")
if Right(s,1)="." then s=left(s,len(s)-1)
s=trim(s)
if Right(s,1)="." then s=left(s,len(s)-1)
s=left(s,255-4)
file=SpecialFolder.desktop.child(s+".aif")
if file<>Nil then
call n.startSpeakingString(EditField1.text,file)
while n.isSpeaking
DelayMBS 0.1
wend
end if
call n.startSpeakingString EditField1.text
End EventHandler
End Control
EventHandler Sub Open()
n=new NSSpeechSynthesizerMBS
if not n.setVoice("com.apple.speech.synthesis.voice.Alex") then
MsgBox "Failed to set voice."
end if
End EventHandler
Property n As NSSpeechSynthesizerMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
Download this example: Speech recorder.zip
The items on this page are in the following plugins: MBS MacClassic Plugin.