Exemplo n.º 1
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
Exemplo n.º 2
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)
Exemplo n.º 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)
Exemplo n.º 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()
     elif name == "pitch":
         print("Pitch adjustment not supported when using NSSS")
     else:
         raise KeyError('unknown property %s' % name)