Search code examples
objective-cmacoscocoaspeech-synthesis

How to find ranges for the 'rate' property of NSSpeechSynthesizer?


I have an OS X app which uses the NSSpeechSynthesizer class to read some text. I need to be able to set the speed of the reading, which is done using the rate property of NSSpeechSynthesizer. However, different voices have different baseline reading rates and different ranges as well. The problem is that I cannot find a way to get this range from the voice so that I know what values are acceptable for the voice. This is important since I want to be able to abstract from the difference in ranges and just let the user choose something like slow/normal/fast. But for a voice with a baseline of 180 words for a minute a value of 100 would be considered slow, which clearly is not the case for a voice with a baseline of 100 words per minute.

Is there a way of getting those ranges? I didn't find anything useful in the class reference for NSSpeechSynthesizer.


Solution

  • You can get the rate of a voice before you change it, and you could estimate that the acceptable range is the default rate ± 50 WPM or something.

    That said, if you're using this to set up a slider, I'd caution you against limiting the user to only “natural”-sounding ranges. Some people, including many blind people, deliberately crank it up as fast as they can stand in order to save listening time.