Page 1 of 1

Changing Speech rate in NSSpeechSynthesizer

Posted: Thu Dec 19, 2019 12:25 am
by MBall
Hi.

I am currently porting a program to mac osx. so i'm new to cocoamessage etc.

I am using some speech output. I have most things working well, but
how do you get and set the speech rate in NSSpeechSynthsizer

I have managed to change and get available voices etc. but I can't seem to figure out how to get or change the speech rate.

if i try

Code: Select all

debug cocoamessage(0,speechsynth,"rate")
to get the rate I seem to always get 0

looks like I need to dig deeper into this cocoamessage thing. looks very interesting.


any help please....

thanks

Re: Changing Speech rate in NSSpeechSynthesizer

Posted: Thu Dec 19, 2019 7:06 am
by wilbert
rate is a float, not an integer value.

Code: Select all

Define rate.f

CocoaMessage(@rate, SpeechSynthesizer, "rate"); get the current speaking rate
Debug rate

rate = 220
CocoaMessage(0, SpeechSynthesizer, "setRate:@", @rate); set a new speaking rate

Re: Changing Speech rate in NSSpeechSynthesizer

Posted: Mon Dec 23, 2019 10:42 am
by MBall
Ah. I was close lol.

Thank you Wilbert. Your help is much appreciated.

Martin.