Changing Speech rate in NSSpeechSynthesizer

Mac OSX specific forum
MBall
User
User
Posts: 12
Joined: Wed Dec 18, 2019 11:33 pm

Changing Speech rate in NSSpeechSynthesizer

Post 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
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Changing Speech rate in NSSpeechSynthesizer

Post 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
Windows (x64)
Raspberry Pi OS (Arm64)
MBall
User
User
Posts: 12
Joined: Wed Dec 18, 2019 11:33 pm

Re: Changing Speech rate in NSSpeechSynthesizer

Post by MBall »

Ah. I was close lol.

Thank you Wilbert. Your help is much appreciated.

Martin.
Post Reply