Maybe someone can use this, maybe not
The code below speaks a smal text with a random selected voice.
Code: Select all
Structure VoiceSpec
creator.l
id.l
EndStructure
ImportC "/System/Library/Frameworks/ApplicationServices.framework/ApplicationServices"
CountVoices (*numVoices.w)
DisposeSpeechChannel (chan)
GetIndVoice (index.w, *voice)
NewSpeechChannel (*voice, *chan)
SpeakText (chan, *textBuf, textBytes.l)
SpeechBusy.w ()
EndImport
CountVoices(@numVoices.w)
index.w = Random(numVoices - 1) + 1
GetIndVoice(index, Voice.VoiceSpec)
NewSpeechChannel(Voice, @chan)
Text.s = "PureBasic speech on OSX"
SpeakText(chan, @Text, Len(Text))
Repeat
Delay(100)
Until SpeechBusy() = #False
DisposeSpeechChannel(chan)