Hi all,
I am new to the list. I am looking for some help relating to one of the Mac standard libraries that python has bindings for. I need help with the AVSpeechSynthesizer object found in the AVFAudio library. I am working on an open source project called accessible_output2, and have been trying to find a good solution for interfacing with the currently running instance of the built in screen reader Voiceover. Specifically, I am looking to send text to a function, and get speech output from Voiceover using the users existing settings if any. This is a library to help provide screen reader output for people who are blind or visually impaired. I already am using NSSpeechSynthesizer to provide default speech output, so if voiceover is not loaded, NSSpeechSynthesizer is used to provide speech using default voiceover settings. However, I would really like to find a way to either communicate directly with the running instance of Voiceover if any, or to use the users voiceover settings to configure the synthesizer object. I have done a lot of research on this, and think that AVSpeechSynthesizer is what I want, however it does not seem to be working as expected. There is a property in the AVSpeechUtterance classs, which is passed into the AVSpeechSynthesizer.speakUtterance method, called prefersAssistiveTechnologySettings. This setting, based on the documentation, is supposed to pull the users existing Voiceover settings, rate, pitch, voice, etc., and use these to configure the utterance object. However, when I run the below code, all I get is Voiceover speaking with the default settings. No matter what I do, it seems that AVSpeechUtterance just is not picking up my custom user settings for Voiceover. To clarify, I have definitely changed the Voiceover default settings. from AVFoundation import AVSpeechSynthesizer from AVFoundation import AVSpeechUtterance voiceover = AVSpeechSynthesizer.alloc().init() utterance = AVSpeechUtterance.speechUtteranceWithString_("hello world") utterance.setPrefersAssistiveTechnologySettings_(True) voiceover.speakUtterance_(utterance) input() Unfortunately, I do not know swift or ObjectiveC. I have been looking into them, and am trying to put together a test of this code in either language, but not having much luck yet. Since this code runs, I really only have two guesses; either the property is not correctly configured in the python bindings, or I am wondering if I need to specify the Boolean differently here to work with the underlying ObjectiveC framework. Does anyone have an idea on what to do next? If this is not the correct place to ask, can someone point me in the right direction of where I can talk to someone who might know more about this? Here is the AVSpeechSynthesizer documentation: https://developer.apple.com/documentation/avfaudio/avspeechsynthesizer?langu age=objc Thanks, Timothy Breitenfeldt
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG