How to use TTS - 10 common examples

To help you get started, we’ve selected a few TTS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cwoac / TTS-Manager / tts / save.py View on Github external
def __init__(self,savedata,filename,ident,filesystem,save_type=SaveType.workshop):
    log=tts.logger()
    self.data = savedata
    self.ident=ident
    if self.data['SaveName']:
      self.save_name=self.data['SaveName']
    else:
      self.save_name=self.ident
    self.save_type=save_type
    self.filesystem = filesystem
    self.filename=filename
    #strip the local part off.
    fileparts=self.filename.split(os.path.sep)
    while fileparts[0]!='Saves' and fileparts[0]!='Mods':
      fileparts=fileparts[1:]
    self.basename=os.path.join(*fileparts)
    log.debug("filename: {},save_name: {}, basename: {}".format(self.filename,self.save_name,self.basename))
    self.urls = [ Url(url,self.filesystem) for url in get_save_urls(savedata) ]
github cwoac / TTS-Manager / tts / url.py View on Github external
def download(self):
    log=tts.logger()
    if self.exists:
      return True
    url=self.url
    protocols=url.split('://')
    if len(protocols)==1:
      log.warn("Missing protocol for {}. Assuming http://.".format(url))
      url = "http://" + url
    log.info("Downloading data for %s." % url)
    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    headers = { 'User-Agent' : user_agent }
    request=urllib.request.Request(url,headers=headers)
    try:
      response=urllib.request.urlopen(request)
    except urllib.error.URLError as e:
      log.error("Error downloading %s (%s)" % (url,e))
      return False
github r3n33 / CozmoLetsRobot / hardware / cozmo.py View on Github external
elif command.isdigit():
            coz.play_anim(name=default_anims_for_keys[int(command)]).wait_for_completed()
    
        #things to say with TTS disabled
        elif command == 'sayhi':
            tts.say( "hi! I'm cozmo!" )
        elif command == 'saywatch':
            tts.say( "watch this" )
        elif command == 'saylove':
            tts.say( "i love you" )
        elif command == 'saybye':
            tts.say( "bye" )
        elif command == 'sayhappy':
            tts.say( "I'm happy" )
        elif command == 'saysad':
            tts.say( "I'm sad" )
        elif command == 'sayhowru':
            tts.say( "how are you?" )
        
        #cube controls
        elif command == "lightcubes":
            print( "lighting cubes" )
            light_cubes( coz )
        elif command == "dimcubes":
            print( "dimming cubes" )
            dim_cubes( coz )

        #sing song example
        elif command == "singsong":
            print( "singing song" )
            sing_song( coz )
github r3n33 / CozmoLetsRobot / hardware / cozmo.py View on Github external
print( "cozmo light was ", is_headlight_on )
            is_headlight_on = not is_headlight_on
            coz.set_head_light(enable=is_headlight_on)
            time.sleep(0.35)

        #animations from example
        elif command.isdigit():
            coz.play_anim(name=default_anims_for_keys[int(command)]).wait_for_completed()
    
        #things to say with TTS disabled
        elif command == 'sayhi':
            tts.say( "hi! I'm cozmo!" )
        elif command == 'saywatch':
            tts.say( "watch this" )
        elif command == 'saylove':
            tts.say( "i love you" )
        elif command == 'saybye':
            tts.say( "bye" )
        elif command == 'sayhappy':
            tts.say( "I'm happy" )
        elif command == 'saysad':
            tts.say( "I'm sad" )
        elif command == 'sayhowru':
            tts.say( "how are you?" )
        
        #cube controls
        elif command == "lightcubes":
            print( "lighting cubes" )
            light_cubes( coz )
        elif command == "dimcubes":
            print( "dimming cubes" )
            dim_cubes( coz )
github letsRobot / letsrobot / letsrobot.py View on Github external
def handle_chat_message(args):
    log.info("chat message received: %s", args)

    if ext_chat:
        extended_command.handler(args)
            
    rawMessage = args['message']
    withoutName = rawMessage.split(']')[1:]
    message = "".join(withoutName)

    try:
        if message[1] == ".":
            exit()
        else:
            tts.say(message, args)
    except IndexError:
        exit()
github r3n33 / CozmoLetsRobot / hardware / cozmo.py View on Github external
coz.set_head_light(enable=is_headlight_on)
            time.sleep(0.35)

        #animations from example
        elif command.isdigit():
            coz.play_anim(name=default_anims_for_keys[int(command)]).wait_for_completed()
    
        #things to say with TTS disabled
        elif command == 'sayhi':
            tts.say( "hi! I'm cozmo!" )
        elif command == 'saywatch':
            tts.say( "watch this" )
        elif command == 'saylove':
            tts.say( "i love you" )
        elif command == 'saybye':
            tts.say( "bye" )
        elif command == 'sayhappy':
            tts.say( "I'm happy" )
        elif command == 'saysad':
            tts.say( "I'm sad" )
        elif command == 'sayhowru':
            tts.say( "how are you?" )
        
        #cube controls
        elif command == "lightcubes":
            print( "lighting cubes" )
            light_cubes( coz )
        elif command == "dimcubes":
            print( "dimming cubes" )
            dim_cubes( coz )

        #sing song example
github r3n33 / CozmoLetsRobot / hardware / cozmo.py View on Github external
#animations from example
        elif command.isdigit():
            coz.play_anim(name=default_anims_for_keys[int(command)]).wait_for_completed()
    
        #things to say with TTS disabled
        elif command == 'sayhi':
            tts.say( "hi! I'm cozmo!" )
        elif command == 'saywatch':
            tts.say( "watch this" )
        elif command == 'saylove':
            tts.say( "i love you" )
        elif command == 'saybye':
            tts.say( "bye" )
        elif command == 'sayhappy':
            tts.say( "I'm happy" )
        elif command == 'saysad':
            tts.say( "I'm sad" )
        elif command == 'sayhowru':
            tts.say( "how are you?" )
        
        #cube controls
        elif command == "lightcubes":
            print( "lighting cubes" )
            light_cubes( coz )
        elif command == "dimcubes":
            print( "dimming cubes" )
            dim_cubes( coz )

        #sing song example
        elif command == "singsong":
            print( "singing song" )
github cwoac / TTS-Manager / tts_cli.py View on Github external
# set logging
    if args.loglevel:
      logmap={
        'debug':logging.DEBUG,
        'info':logging.INFO,
        'warn':logging.WARN,
        'error':logging.ERROR
       }
      tts.logger().setLevel(logmap[args.loglevel])
    else:
      tts.logger().setLevel(logging.WARN)

    # load filesystem values
    if args.directory:
      self.filesystem = tts.filesystem.FileSystem(os.path.abspath(args.directory))
    else:
      self.filesystem = tts.get_default_fs()

    if (args.parser=='list' or args.parser=='export') and not args.save_type:
      # set default
      args.save_type = tts.SaveType.workshop

    if (args.parser=='config' and args.parser_config=='set' and not args.mod_location and not args.tts_location):
      #parser_config.print_usage()
      parser_config_set.error("At least one of -m or -t is required.")

    rc,message = args.func(args)
    if message:
      print(message)
    sys.exit(rc)
github Melissa-AI / Melissa-Core / melissa / stt.py View on Github external
elif profile.data['stt'] == 'telegram':
        def handle(msg):
            chat_id = msg['chat']['id']
            username = msg['chat']['username']
            command = msg['text'].lower().replace("'", "")

            if username == profile.data['telegram_username']:
                print(profile.data['va_name'] +
                      " thinks you said '" + command + "'")
                return command
            else:
                error_msg = 'You are not authorised to use this bot.'
                bot.sendMessage(chat_id, error_msg)

        if profile.data['telegram_token'] == 'xxxx':
            tts('Please enter a Telegram token or configure a different ' +
                'STT in the profile.json file.')
            quit()
        else:
            bot = telepot.Bot(profile.data['telegram_token'])
            bot.notifyOnMessage(handle)

            while True:
                time.sleep(10)
github thomasweng15 / E.V.E. / hal-e / hal-e.py View on Github external
def parse(self, line):
		params = [param.lower() for param in line.split() if param]
		if params == ['hal-e', 'listen']:

			listen()
		
		elif params == ['shut', 'down', 'program']:

			print "Halley will go to sleep now. Good bye!"
			tts.Google().play_wav("./hal-e/wav/sleep.wav")
			print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 
			print "+++++++++++++++++++++++  HAL-E HAS SHUT DOWN  ++++++++++++++++++++++++"
			print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
			sys.exit(1) # note: doesn't exit julius speech listener