Exemple #1
0
 def awakeFromNib(self):
     NSLog('awakeFromNib')
     self.voice = NSSpeechSynthesizer.defaultVoice()
     self.speech = NSSpeechSynthesizer.alloc().initWithVoice_(self.voice)
     self.voiceFullnames = NSSpeechSynthesizer.availableVoices()
     self.voices = [
         name[name.rindex('.') + 1:] for name in self.voiceFullnames
     ]
Exemple #2
0
def getvoicenames():
    """I am returning the names of the voices available on Mac OS X."""
    voices = NSSpeechSynthesizer.availableVoices()
    voicenames = []
    for voice in voices:
        voiceattr = NSSpeechSynthesizer.attributesForVoice_(voice)
        voicename = voiceattr['VoiceName']
        if voicename not in voicenames:
            voicenames.append(voicename)
    return voicenames
Exemple #3
0
 def getProperty(self, name):
     if name == 'voices':
         return [self._toVoice(NSSpeechSynthesizer.attributesForVoice_(v))
                  for v in list(NSSpeechSynthesizer.availableVoices())]
     elif name == 'voice':
         return self._tts.voice()
     elif name == 'rate':
         return self._tts.rate()
     elif name == 'volume':
         return self._tts.volume()
     else:
         raise KeyError('unknown property %s' % name)
Exemple #4
0
 def getProperty(self, name):
     if name == 'voices':
         return [self._toVoice(NSSpeechSynthesizer.attributesForVoice_(v))
                 for v in list(NSSpeechSynthesizer.availableVoices())]
     elif name == 'voice':
         return self._tts.voice()
     elif name == 'rate':
         return self._tts.rate()
     elif name == 'volume':
         return self._tts.volume()
     else:
         raise KeyError('unknown property %s' % name)
Exemple #5
0
    def initWithRequestSpeechHook(self, requestSpeechHook=None):
        self = super(NSSpeechSynthesizerDriver, self).init()
        if self:
            self._speechGenerator = None
            self._currentLabel = 'text'
            self._currentStream = 0
            self._isFirstSpeech = True
            self._delegator = {
                'onStart': [],
                'onWord': [],
                'onEndStream': [],
                'onFinish': []
            }
            self._grabbingSpeech = False
            self._signalsEnabled = True
            self._requestSpeechHook = requestSpeechHook

            self._tts = NSSpeechSynthesizer.alloc().initWithVoice_(None)
            self._tts.setDelegate_(self)

            self._tts.setVolume_(1.0)
            self._tts.setRate_(200)
            self._pauseLength = 0

            self._done = True

        return self
Exemple #6
0
 def getProperty(self, name):
     if name == 'voices':
         return [
             self._toVoice(NSSpeechSynthesizer.attributesForVoice_(v))
             for v in list(NSSpeechSynthesizer.availableVoices())
         ]
     elif name == 'voice':
         return self._tts.voice()
     elif name == 'rate':
         return self._tts.rate()
     elif name == 'volume':
         return self._tts.volume()
     elif name == "pitch":
         print("Pitch adjustment not supported when using NSSS")
     else:
         raise KeyError('unknown property %s' % name)
Exemple #7
0
 def initWithProxy(self, proxy):
     self = super(NSSpeechDriver, self).init()
     if self:
         self._proxy = proxy
         self._tts = NSSpeechSynthesizer.alloc().initWithVoice_(None)
         self._tts.setDelegate_(self)
         # default rate
         self._tts.setRate_(200)
         self._completed = True
     return self
Exemple #8
0
 def initWithProxy(self, proxy):
     self = super(NSSpeechDriver, self).init()
     if self:
         self._proxy = proxy
         self._tts = NSSpeechSynthesizer.alloc().initWithVoice_(None)
         self._tts.setDelegate_(self)
         # default rate
         self._tts.setRate_(200)
         self._completed = True
     return self
Exemple #9
0
 def __init__(self):
     if platform.system() != "Darwin":
         raise RuntimeError("NSSpeechSynthesizer wrapper only available on Mac OS X")
     try:
         from AppKit import NSSpeechSynthesizer
     except ImportError:
         try:
             from Cocoa import NSSpeechSynthesizer
         except:
             raise ImportError("NSSpeechSynthesizer not properly installed on this computer")
     self.tts = NSSpeechSynthesizer.alloc().initWithVoice_(None)
Exemple #10
0
 def wsay(afile):
     #https://stackoverflow.com/questions/12758591/python-text-to-speech-in-macintosh
     #NSSpeechSynthesizer.availableVoices()
     speechSynthesizer = NSSpeechSynthesizer.alloc().init()
     speechSynthesizer.setVoice_(
         'com.apple.speech.synthesis.voice.karen')
     x = open(afile, "r")
     txt = x.read()
     txt = txt.split("====")
     txt = txt[0]
     x.close()
     speechSynthesizer.startSpeakingString_(txt)
Exemple #11
0
def say(text, voice_id=default_voice):
    '''
   |  Read text in user-selected voice, or use default voice if no voice argument is passed in.
   |  It is possible to enter a voice name anywhere in the text entry window using the format: <VoiceName>
   '''
    text_read = text
    ve = NSSpeechSynthesizer.alloc().init()
    ve.setVoice_(voice_id)
    if '>' in text and text[text.index('<') + 1:text.index('>')] in voices:
        ve.setVoice_(voices[text[text.index('<') + 1:text.index('>')]])
        text_read = text[0:text.index('<')] + text[text.index('>') + 1:]
    ve.startSpeakingString_(text_read.lower())
    return
Exemple #12
0
def speak(text, voice, output_file):

    if not voice in VALID_VOICES:
        raise ValueError("Invalid voice, should be one of {0}".format(VOICES))

    ve = NSSpeechSynthesizer.alloc().init()

    ve.setVoice_('com.apple.speech.synthesis.voice.' + voice)
    ve.startSpeakingString_toURL_(text, NSURL.fileURLWithPath_(output_file))
    while ve.isSpeaking():
        pass

    return find_aiff_length_ms(output_file)
Exemple #13
0
def speak(text, voice, output_file):

    if not voice in VALID_VOICES:
        raise ValueError("Invalid voice, should be one of {0}".format(VOICES))

    ve = NSSpeechSynthesizer.alloc().init()

    ve.setVoice_('com.apple.speech.synthesis.voice.' + voice)
    ve.startSpeakingString_toURL_(text, NSURL.fileURLWithPath_(output_file))
    while ve.isSpeaking():
        pass

    return find_aiff_length_ms(output_file)
Exemple #14
0
 def __init__(self):
     self.thread = None
     self.shutdown = False
     system = platform.system()
     if system == 'Darwin':
         try:
             from AppKit import NSSpeechSynthesizer
             voice = 'Vicki'
             base = 'com.apple.speech.synthesis.voice'
             self.voice = base + '.' + voice
             self.speech = NSSpeechSynthesizer.alloc().initWithVoice_(self.voice)
             # sierra?
             if not self.speech:
                 self.speech = NSSpeechSynthesizer.alloc().initWithVoice_(base + '.' + 'Victoria')
             self.say = self.__say_mac
         except ImportError:
             # osx lacks appkit support for python3 (sigh)
             self.say = self.__say_dummy
     elif system == 'Linux':
         self.say = self.__say_linux
     else:
         raise NotImplementedError('Platform not supported')
     self.queue = Queue()
Exemple #15
0
 def playEvent(self, event, notificationData=None):
     if event not in self._events:
         return
     if notificationData is None:
         notificationData = {}
     data = self._events[event]
     text = data.get("speak")
     if text:
         text = populateText(text, notificationData)
         synthesizer = NSSpeechSynthesizer.alloc().initWithVoice_(None)
         synthesizer.startSpeakingString_(text)
     sound = data.get("sound")
     if sound != "no sound" and sound in self._sounds:
         sound = self._sounds[sound]
         sound.play()
Exemple #16
0
    def getVoiceList(self):
        '''
        Returns a list of voices using the following format:
        [description, keyOrId]
        
        The keyOrId is what you would use to set the voice later on.
        '''
        voiceList = NSSpeechSynthesizer.availableVoices()

        myList = []
        for v in voiceList:
            descr = v.split('.')[-1]
            myList.append((unicode(descr), unicode(v)))

        return myList
Exemple #17
0
def tts_NS(word):
    ## Initialise voice synthesizer
    # synth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
    synth = NSSpeechSynthesizer.alloc().initWithVoice_(None)

    ## Set voice values
    synth.setVoice_(VOICE)
    synth.setVolume_(VOLUME)
    synth.setRate_(RATE)

    ## Create NSURL path
    filepath = "../Audio/" + str(len(WORDS)) + "_" + word + "_NS.aiff"
    url = NSURL.fileURLWithPath_(filepath)

    ## Save sythesized word
    synth.startSpeakingString_toURL_(word, url)
Exemple #18
0
def tts_NS(word):
    ## Initialise voice synthesizer
    # synth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
    synth = NSSpeechSynthesizer.alloc().initWithVoice_(None)

    ## Set voice values
    synth.setVoice_(VOICE)
    synth.setVolume_(VOLUME)
    synth.setRate_(RATE)

    ## Create NSURL path
    filepath = "../Audio/" + str(len(WORDS)) + "_" + word + "_NS.aiff"
    url = NSURL.fileURLWithPath_(filepath)

    ## Save sythesized word
    synth.startSpeakingString_toURL_(word, url)
Exemple #19
0
def init_synth(voice=None):
    if not is_appkit_available:
        print "speech synthesizer is not available."
        return None

    def init_(voiceIdentifier):
        return NSSpeechSynthesizer.alloc().initWithVoice_(voiceIdentifier)

    global synth
    if voice is None:
        # no voiceIdentifier is specified
        synth = NSSpeechSynthesizer.alloc().init()
    elif voice[:4] == 'com.apple.speech.synthesis.voice.':
        # an exact voiceIdentifier is specified
        synth = init_(voice)
    else:
        voice1 = 'com.apple.speech.synthesis.voice.' + voice
        voice2 = 'com.apple.speech.synthesis.voice.' + voice.lower() + '.premium'
        synth = init_(voice1) or init_(voice2)
Exemple #20
0
    def set(self, attribute, value):
        '''Sets the specified attribute to the given value

        Recognized attributes: rate, voice, volume'''
        attribute = attribute.lower()
        if attribute == "voice":
            if not isinstance(value, str):
                raise TypeError("voice must be of type \"string\"")
            elif value not in self.available_voices():
                raise ValueError("%s is not an available voice" % (value))
            else:
                lss = NSSpeechSynthesizer.availableVoices()
                for ii in lss:
                    if ii.encode("ascii").split(".")[-1] == value:
                        value = ii
                        break
                vol = self.tts.volume()
                rate = self.tts.rate()
                self.tts.setVoice_(value)
                self.tts.setRate_(rate)
                self.tts.setVolume_(vol)
        elif attribute == 'rate':
            if not isinstance(value, (int, float)):
                raise TypeError(
                    "volume must be either an integer or floating point number"
                )
            elif not 50 <= value <= 600:
                raise ValueError("volume value must be in range 50--600")
            else:
                self.tts.setRate_(value)
        elif attribute == 'volume':
            if not isinstance(value, (int, float)):
                raise TypeError(
                    "volume must be either an integer or floating point number"
                )
            elif not 0 <= value <= 100:
                raise ValueError("volume value must be in range 0--100")
            else:
                self.tts.setVolume_(value * 0.01)
        else:
            raise ValueError("\"%s\" not a recognized attribute" % (attribute))
Exemple #21
0
    def set(self, attribute, value):
        '''Sets the specified attribute to the given value

        Recognized attributes: rate, voice, volume'''
        attribute = attribute.lower()
        if attribute == "voice":
            if not isinstance(value,str):
                raise TypeError("voice must be of type \"string\"")
            elif value not in self.available_voices():
                raise ValueError("%s is not an available voice" % (value))
            else:
                lss = NSSpeechSynthesizer.availableVoices()
                for ii in lss:
                    if ii.encode("ascii").split(".")[-1] == value:
                        value = ii
                        break
                vol = self.tts.volume()
                rate = self.tts.rate()
                self.tts.setVoice_(value)
                self.tts.setRate_(rate)
                self.tts.setVolume_(vol)
        elif attribute == 'rate':
            if not isinstance(value,(int,float)):
                raise TypeError("volume must be either an integer or floating point number")
            elif not 50 <= value <= 600:
                raise ValueError("volume value must be in range 50--600")
            else:
                self.tts.setRate_(value)
        elif attribute == 'volume':
            if not isinstance(value,(int,float)):
                raise TypeError("volume must be either an integer or floating point number")
            elif not 0 <= value <= 100:
                raise ValueError("volume value must be in range 0--100")
            else:
                self.tts.setVolume_(value*0.01)
        else:
            raise ValueError("\"%s\" not a recognized attribute" % (attribute))
Exemple #22
0
try:
    # will run if on OSX
    from AppKit import NSSpeechSynthesizer
    ve = NSSpeechSynthesizer.alloc().init()
    ve.setVoice_('com.apple.speech.synthesis.voice.kate.premium')
    os_version = 1
except Exception, e:
    # run if on linux
    print e
    from os import system
    os_version = 2

import time
import subprocess


def talking(text):
    # talking creates the estimated time to speak and then creates speech
    talk_time = len(text) / 9
    # runs if OSX
    if os_version == 1:
        while ve.isSpeaking:
            ve.startSpeakingString_(text)
            time.sleep(talk_time)
            break
    # runs if Linux
    elif os_version == 2:
        system('pico2wave -w /tmp/ttspeech.wav \"a ' + text + '\"')
        speak = subprocess.call(['aplay', '/tmp/ttspeech.wav'])

Exemple #23
0
"""
This module behaves like pyTTS.
It runs on Mac OS X with NSSpeechSynthesizer.
The only behavior provided is the behavior that tts.py needs.
"""

from AppKit import NSSpeechSynthesizer  # @UnresolvedImport


# not used; provided for compatibility
tts_async = 0
tts_purge_before_speak = 0

_engine = NSSpeechSynthesizer.alloc().init()


class TTS(object):

    def __init__(self):
        pass
    
    def IsSpeaking(self):
        return _engine.isSpeaking()

    def Speak(self, text, *args):
        _engine.startSpeakingString_(text)

    def Stop(self):
        _engine.stopSpeaking()

 def awakeFromNib(self):
     NSLog('awakeFromNib')
     self.voice = NSSpeechSynthesizer.defaultVoice()
     self.speech = NSSpeechSynthesizer.alloc().initWithVoice_(self.voice)
     self.voiceFullnames = NSSpeechSynthesizer.availableVoices()
     self.voices = [name[name.rindex('.') + 1:] for name in self.voiceFullnames]
Exemple #25
0
level = 2
score = 0
font_size = 25
run = True
dict_words = {}
showords = {}
choosed_wd = {}
cur_word = ''
result = ''
q = Queue()
if "Darwin" in platform.system():
    dir = os.path.sep.join(sys.argv[0].split(os.path.sep)[:-1])
    font_file = "/System/Library/Fonts/PingFang.ttc"
    ''' 引入发音引擎'''
    from AppKit import NSSpeechSynthesizer
    speaker = NSSpeechSynthesizer.alloc().init()
    from_voice = "com.apple.speech.synthesis.voice.Princess"
    speaker.setVoice_(from_voice)
else:
    dir = os.path.dirname(__file__)
    font_file = r"C:\windows\Fonts\msyh.ttc"
    import win32com.client as wincl
    speaker = wincl.Dispatch("SAPI.SpVoice")

''' 引入google在线翻译引擎'''
from googletrans import Translator
translator= Translator()
def translat(word,q):
    res = translator.translate(word,src='en', dest='zh-cn').text
    q.put_nowait(res)
Exemple #26
0
 def __init__(self, message):
     self.synth = NSSpeechSynthesizer.alloc().initWithVoice_(None)
     self.synth.startSpeakingString_(message)
Exemple #27
0
 def available_voices(self):
     '''Returns a list of voices available for use with NSSS'''
     voices = NSSpeechSynthesizer.availableVoices()
     voices = list(voices)
     voices = [x.encode("ascii").split(".")[-1] for x in voices]
     return voices
Exemple #28
0
from AppKit import NSSpeechSynthesizer
speechSynthesizer = NSSpeechSynthesizer.alloc().initWithVoice_(
    "com.apple.speech.synthesis.voice.Bruce")
print "hello"
speechSynthesizer.startSpeakingString_('Hi! Nice to meet you!')
Exemple #29
0
 def init_(voiceIdentifier):
     return NSSpeechSynthesizer.alloc().initWithVoice_(voiceIdentifier)
Exemple #30
0
from __future__ import unicode_literals, print_function, division

import os
import aifc
import requests
import subprocess
from AppKit import NSSpeechSynthesizer, NSURL
import xml.etree.ElementTree as ElementTree
from bs4 import BeautifulSoup

VALID_VOICES = [str(x.replace('com.apple.speech.synthesis.voice.', '')) for x in NSSpeechSynthesizer.availableVoices()]
VOICES =['lee.premium', 'fiona.premium', 'emily.premium', 'Alex', 'tom.premium', 'jill.premium', 'sangeeta.premium']

ARXIV_URL = "http://export.arxiv.org/rss/astro-ph"
HEADERS = {'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'}

JINGLE = {
    '[astro-ph.CO]': 'jingles/CO.aiff',
    '[astro-ph.EP]': 'jingles/EP.aiff',
    '[astro-ph.GA]': 'jingles/GA.aiff',
    '[astro-ph.HE]': 'jingles/HE.aiff',
    '[astro-ph.IM]': 'jingles/IM.aiff',
    '[astro-ph.SR]': 'jingles/SR.aiff',
    'other': 'jingles/other.aiff',
}

def add_jingle(output_file, subject):
    jingle = JINGLE.get(subject, JINGLE['other'])
    with open('tmp_list', 'w') as file_list:
        file_list.write("file '{0}'\n".format(jingle))
        file_list.write("file '{0}'\n".format(output_file))
Exemple #31
0
 def available_voices(self):
     '''Returns a list of voices available for use with NSSS'''
     voices = NSSpeechSynthesizer.availableVoices()
     voices = list(voices)
     voices = [x.encode("ascii").split(".")[-1] for x in voices]
     return voices
Exemple #32
0
'''

from AppKit import NSSpeechSynthesizer
try:
    from Tkinter import *  # 2.X
except:
    from tkinter import *  # 3.X

# inits
text = ''
entry_str = ''
entry_length = 0
default_voice = 'com.apple.speech.synthesis.voice.Alex'
voices = {
    str(voice[33:]): str(voice)
    for voice in NSSpeechSynthesizer.availableVoices()
}
voices_lst = [item.lower() for item in voices.keys()]


def say(text, voice_id=default_voice):
    '''
   |  Read text in user-selected voice, or use default voice if no voice argument is passed in.
   |  It is possible to enter a voice name anywhere in the text entry window using the format: <VoiceName>
   '''
    text_read = text
    ve = NSSpeechSynthesizer.alloc().init()
    ve.setVoice_(voice_id)
    if '>' in text and text[text.index('<') + 1:text.index('>')] in voices:
        ve.setVoice_(voices[text[text.index('<') + 1:text.index('>')]])
        text_read = text[0:text.index('<')] + text[text.index('>') + 1:]
Exemple #33
0
from AppKit import NSSpeechSynthesizer
import Cocoa

TEXT = "Good-bye! Nice to know you."

# TTS variables
RATE = 170    # Value in words per minute; human 180-220
VOLUME = 0.5  # Floating point value in the range of 0.0 to 1.0, inclusive.
VOICE = 'com.apple.speech.synthesis.voice.Agnes'  # String identifier of the active voice.
              ### RUN showcase_voices.py TO SEE ALL AVAILABLE VOICES IN YOUR SYSTEM ###

if __name__ == '__main__':

    ## Initialise voice synthesizer
    # synth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
    synth = NSSpeechSynthesizer.alloc().initWithVoice_(None)

    ## Fetch all system voices available
    voices = NSSpeechSynthesizer.availableVoices()

    ## Set voice values
    synth.setVolume_(VOLUME)
    synth.setRate_(RATE)
    # synth.setPitch_(PITCH)

    ## Print out all system voices available
    for voice in voices:
        print voice

    for voice in voices:
        # synth = NSSpeechSynthesizer.alloc().initWithVoice_(voice)
Exemple #34
0
#import pyttsx
#engine = pyttsx.init()
#engine.say('Good morning.')
#engine.runAndWait()

from AppKit import NSSpeechSynthesizer

print(NSSpeechSynthesizer.availableVoices())
speechSynthesizer = NSSpeechSynthesizer.alloc().initWithVoice_(
    "com.apple.speech.synthesis.voice.karen")
#speechSynthesizer = NSSpeechSynthesizer.alloc().initWithVoice_("com.apple.speech.synthesis.voice.sara")
test = speechSynthesizer.startSpeakingString_(
    'Hi! Nice to meet you! So how are you today? Feeling anxious. Quite normal considering this is your first time in space. I am sure you will get used to zero gravity within a few weeks. We will all be here to help you through these first critical weeks.'
)
#test = speechSynthesizer.startSpeakingString_('Hej, jeg hedder Sara. Jeg er en dansk stemme.')


def methods(cls):
    return [x for x, y in cls.__dict__.items() if type(y) == FunctionType]


#print(NSSpeechSynthesizer.__dict__)
#print(methods(NSSpeechSynthesizer))
#print(list(dir(NSSpeechSynthesizer)))
#print(NSSpeechSynthesizer.__dict__.items())

#attrib = NSSpeechSynthesizer.attributes(voice)
#print(voice.attributesforVoice())
#print(type(voice))

#print(dir(voice))
Exemple #35
0
def say(txt):
	voice = NSSpeechSynthesizer.defaultVoice()
	speech = NSSpeechSynthesizer.alloc().initWithVoice_(voice)
	speech.startSpeakingString_(txt)
Exemple #36
0
from __future__ import unicode_literals, print_function, division

import os
import aifc
import requests
import subprocess
from AppKit import NSSpeechSynthesizer, NSURL
import xml.etree.ElementTree as ElementTree
from bs4 import BeautifulSoup

VALID_VOICES = [str(x.replace('com.apple.speech.synthesis.voice.', '')) for x in NSSpeechSynthesizer.availableVoices()]
VOICES =['lee.premium', 'fiona.premium', 'emily.premium', 'Alex', 'tom.premium', 'jill.premium', 'sangeeta.premium']

ARXIV_URL = "http://export.arxiv.org/rss/astro-ph"

JINGLE = {
    '[astro-ph.CO]': 'jingles/CO.aiff',
    '[astro-ph.EP]': 'jingles/EP.aiff',
    '[astro-ph.GA]': 'jingles/GA.aiff',
    '[astro-ph.HE]': 'jingles/HE.aiff',
    '[astro-ph.IM]': 'jingles/IM.aiff',
    '[astro-ph.SR]': 'jingles/SR.aiff',
    'other': 'jingles/other.aiff',
}

def add_jingle(output_file, subject):
    jingle = JINGLE.get(subject, JINGLE['other'])
    with open('tmp_list', 'w') as file_list:
        file_list.write("file '{0}'\n".format(jingle))
        file_list.write("file '{0}'\n".format(output_file))
    with open('tmp_log', 'w') as f_log:
Exemple #37
0
# ===============================================================================

# ============= enthought library imports =======================

from __future__ import absolute_import
import time
from pyface.timer.timer import Timer
from traits.api import HasTraits, Button, Int, Bool, Property
from traitsui.api import Handler, View, Item, UItem, VGroup, HGroup, spring, Spring, ButtonEditor

from pychron.core.ui.lcd_editor import LCDEditor

try:
    from AppKit import NSSpeechSynthesizer

    SPEECHSYNTH = NSSpeechSynthesizer.alloc().initWithVoice_(
        "com.apple.speech.synthesis.voice.Vicki")
    SPEECHSYNTH.setRate_(275)
except ImportError:
    SPEECHSYNTH = None


class StopWatchHandler(Handler):
    def closed(self, info, isok):
        info.object.destroy()


class StopWatch(HasTraits):
    start_stop_button = Button
    reset_button = Button('Reset')
    current_time = Int
    call_interval = Int(5)
Exemple #38
0
# ===============================================================================

# ============= enthought library imports =======================

from __future__ import absolute_import
import time
from pyface.timer.timer import Timer
from traits.api import HasTraits, Button, Int, Bool, Property
from traitsui.api import Handler, View, Item, UItem, VGroup, HGroup, spring, Spring, ButtonEditor

from pychron.core.ui.lcd_editor import LCDEditor

try:
    from AppKit import NSSpeechSynthesizer

    SPEECHSYNTH = NSSpeechSynthesizer.alloc().initWithVoice_("com.apple.speech.synthesis.voice.Vicki")
    SPEECHSYNTH.setRate_(275)
except ImportError:
    SPEECHSYNTH = None


class StopWatchHandler(Handler):
    def closed(self, info, isok):
        info.object.destroy()


class StopWatch(HasTraits):
    start_stop_button = Button
    reset_button = Button('Reset')
    current_time = Int
    call_interval = Int(5)