Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.*env/
build/
dist/'
docs/_build
Expand Down
1 change: 1 addition & 0 deletions accessible_output2/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def _load_com(*names):

if platform.system() == "Darwin":
from . import voiceover
from . import nsspeechsynthesizer

if platform.system() == "Linux":
from . import speech_dispatcher
Expand Down
28 changes: 28 additions & 0 deletions accessible_output2/outputs/nsspeechsynthesizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from platform import system as get_current_system
from .base import Output

class MacSpeech(Output):

"""Speech output supporting Apple MacOS NSSpeechSynthesizer."""

name = "MacSpeech"
priority = 101
system_output = True

def __init__(self, *args, **kwargs):
from AppKit import NSSpeechSynthesizer
self.synth = NSSpeechSynthesizer.alloc().init()

def speak(self, text: str, interrupt: bool = False) -> bool:
if interrupt:
self.silence()
return self.synth.startSpeakingString_(text)

def silence(self):
self.synth.stopSpeaking()

def is_active(self):
return get_current_system() == "Darwin"


output_class = MacSpeech
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
libloader
platform_utils
pyobjc; sys_platform == 'darwin'