When using the Speak Command, is it possible to select a specific voice, or are you stuck with whatever is currently being used by the system?
No Plugin needed (at least on Mac). You may either use declares or just AppleScript.
Public Function ExecuteAppleScript(TheScript As String) as String Soft Declare Function NSClassFromString Lib "Foundation" (classname As CFStringRef) As ptr Soft Declare Function initWithSource Lib "Cocoa" selector "initWithSource:" (obj As ptr,source As CFStringRef) As ptr Soft Declare Function executeAndReturnError Lib "Cocoa" selector "executeAndReturnError:" (obj As ptr,ByRef error As ptr) As ptr Soft Declare Function alloc Lib "Cocoa" selector "alloc" (classRef As Ptr) As Ptr Soft Declare Function autorelease Lib "Cocoa" selector "autorelease" (classRef As Ptr) As Ptr Soft Declare Function stringValue Lib "Cocoa" selector "stringValue" (classRef As Ptr) As CFStringRef Dim nsscript As ptr=autorelease(initWithSource(alloc(NSClassFromString("NSAppleScript")),TheScript))) Dim err As ptr Dim descriptor As ptr=executeAndReturnError(nsscript,err) If descriptor = Nil Then MsgBox "An error occured" Else Return stringValue(descriptor) End If End Function
Now call it e.g. via
Call ExecuteAppleScript("say ""This is a test"" Using ""Anna""") Call ExecuteAppleScript("say ""This is a test"" Using ""Markus""")
MacOSlib offers several speech-options besides selecting any voice of your choice.
The 64bit version works too, although with this particular version (64bit) at present one cannot set the "speed-rate".
Thanks, Carlo. I'll take a look at that. Speed-rate shouldn't be an issue since I'm only interested in speaking one word at a time.