tspivey / tdsr

A console screen reader for macOS and Linux
GNU General Public License v3.0
78 stars 18 forks source link

Rewrite the Mac speech server to use AVSpeechSynthesizer #32

Closed mikolysz closed 8 months ago

mikolysz commented 8 months ago

The NSSpeechSynthesizer framework that TDSR has been using so far is now deprecated and has compatibility issues with Mac OS 14.

This PR rewrites the Mac speech server to use AVSpeechSynthesizer.

There is a bug with AVSpeechSynthesizer (at least on 13) where it uses Vocalizer Samantha instead of your system voice by default. Therefore, a rudimentary implementation of voice selection has been provided. AVSpeechSynthesizer is also told to use Voice Over's speech settings when possible, but this doesn't seem to work for me.

In this implementation, voices are chosen by their numerical index. (using the shift+v key combination in the config mode of TDSR). Those indexes are stable across TDSR runs, but might change when voices are added or removed. A better way to do this would be to select voices by their bundle identifiers, however, this would require extensive refactoring. Currently, there is no way for the speech server to deliver any kind of output to TDSR (which would be required for voice enumeration). We would also need to write a new key handler to manage the voice list. The list can get quite large, so some sort of hierarchical navigation (probably by language) would need to be supported.

TheQuinbox commented 8 months ago

AVSpeechSynthesizer not respecting VoiceOver settings when told to is not an exclusively you problem, I think that functionality is just entirely and completely broken. I was never able to make it work.