macoslib speech no sound?

Hello,
i wanted to change the default voice so i am trying the macoslib (64bit) MacSpeechSynthesizerExample but i cannot get any sound out.
The built-in xojo speak works but it does not allow you to select the voice…

Any suggestions?

Once you have ported macOSLib into your project, every time you access a voice, initialize it with alex voice, then call your preferred voice.
At least this is the way I have it working in 64bit.

that worked for me, thanks!

i found another way, using applescript to speak with a predefined voice
say -v “anna” “hello”

putting this in a constant as string myscript:

/usr/bin/osascript -e say -v "anna" "hello"

and starting it with :

dim mshell as new shell mshell.Execute(app.myscript)

works, too.

But i cannot make it work without a constant and the “-v” option

dim mshell as new shell mshell.Execute("osascript -e 'say -v ""anna"" ""hello""'")

do i have to escape something? without -v ““anna”” it works?

Use the function “ExecuteAppleScript” from Proper way to execute an AppleScript? .

Then you use plain AS source e.g.

say "testing" using "Markus"

No Shell and no Plugin is needed here.

do i have to use it with:
call ExecuteAppleScript ?

can you give me an example?

dim mshell as new shell mshell.Execute("osascript -e 'say ""hello""'")

works, can someone please help me escaping this correctly to get it working with the “-v Anna” option?

dim mshell as new shell mshell.Execute("osascript -e 'say -v ""anna"" ""hello""'")

does not.

got it:
mshell.Execute(“osascript -e ‘say ““hello”” using ““Anna””’”)

Ages ago I used it; and as far as I remember I used to send values for volume, rate and pitch too.
But I cannot remember whether I could use the “isSpeaking” function available.

Can you let us know whether MAS accepts it or not? I mean, because of the appleScript.
Thanks.

[quote=476649:@Marco Weinrich]do i have to use it with:
call ExecuteAppleScript ?
can you give me an example?[/quote]

Copy the “ExecuteAppleScript” function in your project and call it like this example:

Dim s As String = "say ""testing"" using ""Markus""" Dim asResult As String = ExecuteAppleScript(s)