def speakTrivia(self): trivia = self.fp.getChoice() espeak.set_voice("mb-us2") espeak.set_parameter(espeak.Parameter.Rate, 2) espeak.synth(trivia[0]) time.sleep(self.delay) espeak.synth(trivia[1]) time.sleep(self.delay*2)
def get_rot_total(): global cont_total while (1): if (GPIO.input(16) == 1): # Verificação de borda espeak.set_parameter(espeak.Parameter.Rate, 150, 0) espeak.synth("Foram dadas" + str(cont_total) + "voltas.") espeak.set_parameter(espeak.Parameter.Rate, 150, 0) time.sleep(0.5)
def run( self, homeBot ): espeak.set_parameter( espeak.Parameter.Rate, 170 ) espeak.set_parameter( espeak.Parameter.Volume, 100 ) espeak.set_parameter( espeak.Parameter.Pitch, 0 ) espeak.set_parameter( espeak.Parameter.Range, 99 ) espeak.set_parameter( espeak.Parameter.Wordgap, 10 ) espeak.set_voice( name="spanish-mbrola-2", gender=espeak.Gender.Female ); self.homeBot = homeBot self.user();
def __init__(self): rospy.init_node("tts_engine", anonymous=True) rospy.Subscriber("edwin_speech_cmd", String, self.callback, queue_size=10) espeak.set_parameter(espeak.Parameter.Rate,150) espeak.set_parameter(espeak.Parameter.Pitch,50) espeak.set_voice("en") print "Ready to speak!"
def run(self): global cont_total while not self.stopped.wait(10): x1 = cont_total self.stopped.wait(5) x2 = cont_total rpm = (x2 - x1)*60/5 x1 = x2 espeak.set_parameter(espeak.Parameter.Rate, 150, 0) espeak.synth("Sua RPM atual é de:" + str(int(rpm))) espeak.set_parameter(espeak.Parameter.Rate, 375, 0)
def run(self): name = self.config.configs['espeak_name'] rate = int(self.config.configs['espeak_rate']) espeak.set_voice(name) espeak.set_parameter(espeak.Parameter.Rate, rate) while not self._stop.isSet(): try: phrase = self.wordsQueue.get(True, 0.05) espeak.synth(phrase.encode('utf8')) except Queue.Empty: continue
def run(self): name = self.config.configs['espeak_name'] rate = int(self.config.configs['espeak_rate']) espeak.set_voice(name) espeak.set_parameter(espeak.Parameter.Rate,rate) while not self._stop.isSet(): try: phrase = self.wordsQueue.get(True,0.05) espeak.synth(phrase.encode('utf8')) except Queue.Empty: continue
def __init__(self, state, rate=None, voice=None): ''' @see SpeechOutput.__init__() @type rate: int @param rate: The speed at which to speek. An integer value between 0 and 450. The default rate is 175. @type voice: str @param voice: The voice to use. See C{espeak.list_voices()}. ''' super(EspeakOutput, self).__init__(state) if rate is not None: espeak.set_parameter(espeak.Parameter.Rate, int(rate)) if voice is not None: espeak.set_voice(str(voice))
def f_say(s_params=None, *args, **kwargs): """ Say a message using espeak. """ if not USE_ESPEAK: return result = "" if s_params: say_list = re.findall(regex_say, s_params) print say_list for match, message, speed in say_list: speed = re.sub(regex_numeric, "", speed) if speed: speed = int(speed) speed = 450 if speed > 450 else speed espeak.set_parameter(espeak.Parameter.Rate, speed) _espeak_synth(message) return result
def irc_speak(word, word_eol, users): """Checks to see if a user is set to be voiced, and if so synthesizes their text""" if word[0] in options: # check to see if the user is in the options dictionary (word[0] == their nick) [espeak.set_parameter(aliases[arg], options[word[0]]["args"][arg]) for arg in options[word[0]]["args"]] # options[word[0]]["args"][arg] is the same as options[nickname]["args"][arg] (where arg is some one of the names in aliases # which corresponds to some integer value in options[nick][args]) espeak.set_voice(name=options[word[0]]["language"]) espeak.synth(word[1]) xchat.emit_print("Channel", word[0], word[1]) return xchat.EAT_NONE return xchat.EAT_NONE # return nothing because they weren't in the options dictionary
def que(self,sentence): """ Interactua con eSpeak el motor de TTS usado para el habla. La cadena de texto que recibe como argumento es pasada a un nuevo proceso del TTS con los parametros prestablecidos de sintesis de voz. Usa python-espeak: https://answers.launchpad.net/python-espeak Arguments: *args: str Return: none """ espeak.set_voice("es-la+m2") espeak.set_parameter(espeak.Parameter.Capitals,20) espeak.set_parameter(espeak.Parameter.Rate, 140) espeak.synth(sentence)
def init_espeak(): if USE_SPEECH: # set up speech synth espeak.set_voice(get_language()); espeak.set_parameter(espeak.Parameter.Pitch, 1) espeak.set_parameter(espeak.Parameter.Rate, 145) espeak.set_parameter(espeak.Parameter.Range, 600)
def activate_preferences(self): espeak.set_parameter(espeak.Parameter.Rate, self.voice_message_rate) espeak.set_parameter(espeak.Parameter.Pitch, self.voice_message_pitch) espeak.set_parameter(espeak.Parameter.Volume, self.voice_message_volume) espeak.set_voice(espeak.list_voices()[self.voice_message_voice].name) self.highlight_tag = self.textbuffer.create_tag('Reading') self.highlight_tag.set_property( 'foreground', Gdk.color_parse(self.highlight_color).to_string()) self.highlight_tag.set_property('font', self.highlight_font) self.highlight_tag.set_property( 'background', Gdk.color_parse(self.background_highlight_color).to_string()) pangoFont = Pango.FontDescription(self.font) self.textview.modify_font(pangoFont) self.textview.modify_fg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.font_color)) self.textview.modify_bg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.background_color)) self.set_dict("%s" % self.key_value[self.language]) if (self.require_scanner_refresh): self.scanner_refresh(self)
def Apply_settings(self,widget,data=None): try: language = (self.model_language[self.index_language][0]) except AttributeError: language = self.language else: pass self.cam_take_time=self.spinbutton_cam_time.get_value_as_int() self.cam_waitkey=self.spinbutton_fps.get_value_as_int() self.cam_device=self.combobox_cam_device.get_active() self.voice_message_voice=self.combobox_voice.get_active() self.voice_message_rate=int(self.hscale_rate.get_value()) self.voice_message_volume=int(self.hscale_volume.get_value()) self.voice_message_pitch=int(self.hscale_pitch.get_value()) if self.checkbutton_say.get_active() == True: self.voice_message_state = 1 else: self.voice_message_state = 0 self.font=self.font_button.get_font_name();self.highlight_font=self.fontbutton_highlight_button.get_font_name(); self.background_color=self.background_color_button.get_color().to_string();self.font_color=self.font_color_button.get_color().to_string(); self.highlight_color=self.highlight_color_button.get_color().to_string();self.time_between_repeated_scanning=self.time_spin.get_value_as_int(); self.background_highlight_color=self.highlight_background_color_button.get_color().to_string(); self.scan_resolution = self.re_spin.get_value_as_int();self.scan_brightness=self.bt_spin.get_value_as_int();self.scan_area=self.index_area; self.ocr_engine=self.model_engine[self.index_engine][0];self.language=language self.mode_of_rotation=self.index_rotation;self.number_of_pages_to_scan=self.pages_spin.get_value_as_int();self.page_numbering_type=self.index_numbering; self.starting_page_number=self.start_spin.get_value_as_int();self.scanner_driver=self.driver_cb.get_active() if self.angle_cb.get_visible() ==True: model_angle = self.angle_cb.get_model() self.rotation_angle = model_angle[self.angle_cb.get_active()][0] self.auto_skew = int(self.checkbutton_skew.get_active()) espeak.set_parameter(espeak.Parameter.Rate,self.voice_message_rate) espeak.set_parameter(espeak.Parameter.Pitch,self.voice_message_pitch) espeak.set_parameter(espeak.Parameter.Volume,self.voice_message_volume) espeak.set_voice(self.voice_list[self.voice_message_voice]) self.highlight_tag.set_property('foreground',gtk.gdk.Color(self.highlight_color)) self.highlight_tag.set_property('font',self.highlight_font) self.highlight_tag.set_property('background',gtk.gdk.Color(self.background_highlight_color)) pangoFont = pango.FontDescription(self.font) self.textview.modify_font(pangoFont) self.textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(self.background_color)) self.textview.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(self.font_color)) self.dict = enchant.Dict("%s" % self.key_value[self.language]) self.set_preferences_to_file() self.notify("Lios ,Settings Reloaded!",False,None,True) self.window.destroy()
def setParam(param, val): if param == "Pitch": espeak.set_parameter(espeak.Parameter.Pitch, val) elif param == "Volume": espeak.set_parameter(espeak.Parameter.Volume, val) elif param == "Rate": espeak.set_parameter(espeal.Parameter.Rate, val) else: return "_problem Unknown Parameter" return "OK"
def set_parameters(self, voice = None, capitals = None, pitch = None, punctuation = None, rate = None, volume = None, wordgap = None): """ Set espeak parameters. """ result = True if voice is not None: voices = self.list_voices() if voice not in voices: print('WARNING: Voice ', voice, ' not supported by espeak.', 'Using default voice instead.', file = sys.stderr) voice = 'default' if not espeak.set_voice(voice): print('WARNING: Voice ', voice, ' could not be set.', file = sys.stderr) result = False if capitals is not None: if not espeak.set_parameter(core.parameter_CAPITALS, capitals): print('WARNING: Parameter capitals could not be set to', capitals, file = sys.stderr) result = False if pitch is not None: if not espeak.set_parameter(core.parameter_PITCH, pitch): print('WARNING: Parameter pitch could not be set to', pitch, file = sys.stderr) result = False if punctuation is not None: if not espeak.set_parameter(core.parameter_PUNCTUATION, punctuation): print('WARNING: Parameter punctuation could not be set to', punctuation, file = sys.stderr) result = False if rate is not None: if not espeak.set_parameter(core.parameter_RATE, rate): print('WARNING: Parameter rate could not be set to', rate, file = sys.stderr) result = False if volume is not None: if not espeak.set_parameter(core.parameter_VOLUME, volume): print('WARNING: Parameter volume could not be set to', volume, file = sys.stderr) result = False if wordgap is not None: if not espeak.set_parameter(core.parameter_WORDGAP, wordgap): print('WARNING: Parameter wordgap could not be set to', wordgap, file = sys.stderr) result = False return result
def activate_preferences(self): espeak.set_parameter(espeak.Parameter.Rate,self.voice_message_rate) espeak.set_parameter(espeak.Parameter.Pitch,self.voice_message_pitch) espeak.set_parameter(espeak.Parameter.Volume,self.voice_message_volume) espeak.set_voice(espeak.list_voices()[self.voice_message_voice].name) self.highlight_tag = self.textbuffer.create_tag('Reading') self.highlight_tag.set_property('foreground',Gdk.color_parse(self.highlight_color).to_string()) self.highlight_tag.set_property('font',self.highlight_font) self.highlight_tag.set_property('background',Gdk.color_parse(self.background_highlight_color).to_string()) pangoFont = Pango.FontDescription(self.font) self.textview.modify_font(pangoFont) self.textview.modify_fg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.font_color)) self.textview.modify_bg(Gtk.StateFlags.NORMAL, Gdk.color_parse(self.background_color)) self.set_dict("%s" % self.key_value[self.language]) if (self.require_scanner_refresh): self.scanner_refresh(self)
def main(argv): local_time = time.localtime() # Set TTS parameters espeak.set_parameter(espeak.Parameter.Pitch, 60) espeak.set_parameter(espeak.Parameter.Rate, 150) espeak.set_parameter(espeak.Parameter.Range, 600) # Set niceness of this process os.nice(-3) # Create DATA_DIR if not available try: os.makedirs(DATA_DIR) except: pass duration = None freq_left = freq_right = None # Parse cmdline args try: freq_left = argv[1] freq_right = argv[2] duration = int(argv[3]) n_trials = int(argv[4]) except: print "Usage: %s <frequency left> <frequency right> <trial_duration> <n_trials>" % argv[ 0] sys.exit(1) # Spawn SSVEP and DSPD process ssvepd = None dspd = None try: ssvepd = subprocess.Popen( ["./bbb-bci-ssvepd.py", freq_left, freq_right]) #dspd = subprocess.Popen(["./bbb-bci-dspd.py"]) except OSError, e: print "Error: Can't launch SSVEP/DSP subprocesses: %s" % e sys.exit(2)
def main(argv): local_time = time.localtime() # Set TTS parameters espeak.set_parameter(espeak.Parameter.Pitch, 60) espeak.set_parameter(espeak.Parameter.Rate, 150) espeak.set_parameter(espeak.Parameter.Range, 600) # Set niceness of this process os.nice(-3) # Create DATA_DIR if not available try: os.makedirs(DATA_DIR) except: pass duration = None freq_left = freq_right = None # Parse cmdline args try: freq_left = argv[1] freq_right = argv[2] duration = int(argv[3]) n_trials = int(argv[4]) except: print "Usage: %s <frequency left> <frequency right> <trial_duration> <n_trials>" % argv[0] sys.exit(1) # Spawn SSVEP and DSPD process ssvepd = None dspd = None try: ssvepd = subprocess.Popen(["./bbb-bci-ssvepd.py", freq_left, freq_right]) # dspd = subprocess.Popen(["./bbb-bci-dspd.py"]) except OSError, e: print "Error: Can't launch SSVEP/DSP subprocesses: %s" % e sys.exit(2)
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import rospy from espeak import espeak from std_msgs.msg import String #espeak.synth('Hello, world') #espeak.list_voices()# Ver lista de idiomas #Ingles EUA 'en' #Español lationoamerica 'es-la' #Alema 'de' global lang lang = 'en' espeak.set_parameter(espeak.Parameter.Pitch, 50) # proporcional con el grado de agudeza de la voz espeak.set_parameter(espeak.Parameter.Rate, 150) # proporcional con la velocidad de las voces espeak.set_parameter(espeak.Parameter.Range, 700) def texto(data): global lang espeak.set_voice(lang) espeak.synth(data.data) def idioma(data): global lang espeak.set_voice(data.data) lang = data.data
def Apply_settings(self, widget, data=None): try: language = (self.model_language[self.index_language][0]) except AttributeError: language = self.language else: pass self.cam_take_time = self.spinbutton_cam_time.get_value_as_int() self.cam_waitkey = self.spinbutton_fps.get_value_as_int() self.cam_device = self.combobox_cam_device.get_active() self.voice_message_voice = self.combobox_voice.get_active() self.voice_message_rate = int(self.hscale_rate.get_value()) self.voice_message_volume = int(self.hscale_volume.get_value()) self.voice_message_pitch = int(self.hscale_pitch.get_value()) if self.checkbutton_say.get_active() == True: self.voice_message_state = 1 else: self.voice_message_state = 0 self.font = self.font_button.get_font_name() self.highlight_font = self.fontbutton_highlight_button.get_font_name() self.background_color = self.background_color_button.get_color( ).to_string() self.font_color = self.font_color_button.get_color().to_string() self.highlight_color = self.highlight_color_button.get_color( ).to_string() self.time_between_repeated_scanning = self.time_spin.get_value_as_int( ) self.background_highlight_color = self.highlight_background_color_button.get_color( ).to_string() self.scan_resolution = self.re_spin.get_value_as_int() self.scan_brightness = self.bt_spin.get_value_as_int() self.scan_area = self.index_area self.ocr_engine = self.model_engine[self.index_engine][0] self.language = language self.mode_of_rotation = self.index_rotation self.number_of_pages_to_scan = self.pages_spin.get_value_as_int() self.page_numbering_type = self.index_numbering self.starting_page_number = self.start_spin.get_value_as_int() self.scanner_driver = self.driver_cb.get_active() if self.angle_cb.get_visible() == True: model_angle = self.angle_cb.get_model() self.rotation_angle = model_angle[self.angle_cb.get_active()][0] self.auto_skew = int(self.checkbutton_skew.get_active()) espeak.set_parameter(espeak.Parameter.Rate, self.voice_message_rate) espeak.set_parameter(espeak.Parameter.Pitch, self.voice_message_pitch) espeak.set_parameter(espeak.Parameter.Volume, self.voice_message_volume) espeak.set_voice(self.voice_list[self.voice_message_voice]) self.highlight_tag.set_property('foreground', gtk.gdk.Color(self.highlight_color)) self.highlight_tag.set_property('font', self.highlight_font) self.highlight_tag.set_property( 'background', gtk.gdk.Color(self.background_highlight_color)) pangoFont = pango.FontDescription(self.font) self.textview.modify_font(pangoFont) self.textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(self.background_color)) self.textview.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(self.font_color)) self.dict = enchant.Dict("%s" % self.key_value[self.language]) self.set_preferences_to_file() self.notify("Lios ,Settings Reloaded!", False, None, True) self.window.destroy()
#!/usr/bin/python import wx import Image import time import os from espeak import espeak espeak.set_parameter(espeak.Parameter.Rate, 130) # 110 is kinda sloooow, 220 is very fast. os.environ['DISPLAY'] = ':0' fname = '/tmp/gfi_box.png' def getImage(cntY=0): # startX and startY are ints for what line we are on. print "Running getImageCompare()" t = wx.App() # required, unused screen = wx.ScreenDC() bmp = wx.EmptyBitmap(160, 25) #abStartX=1050 # initial start X coordinate abStartY = 164 # initial start Y coordinate ycoord = abStartY + (25 * cntY) # move down per iteration of cntY mem = wx.MemoryDC(bmp) mem.Blit(0, 0, 160, 25, screen, 1050, ycoord) # get only the area we need del mem # Release image # save to file - don't like this but other options are Windows only bmp.SaveFile(fname, wx.BITMAP_TYPE_PNG) return True
from twisted.internet import protocol from twisted.internet import reactor, utils from twisted.python.filepath import FilePath import re, os try: from espeak import espeak synth = espeak.synth espeak.set_parameter(espeak.Parameter.Rate, 100) espeak.set_parameter(espeak.Parameter.Volume, 100) #espeak.set_voice('mb-us1') espeak.synth("hello") #print espeak.get_parameter("rate") except Exception, e: print e print "no espeak" synth = None import itertools newvoice = itertools.cycle(['en-scottish', 'english', 'lancashire', 'english_rp', 'english_wmids', 'english-us', 'en-westindies']).next espeak_consonants = {(4,): 'n', # consonants (3,): 't', (1,): 'r', (2,): 's', (5,): 'd', (1,4): 'l', (2,3): 'D', (3,4): 'z',
brainLoaded = True # Now that we've loaded the brain, save it to speed things up for # next time. kern.saveBrain("standard.brn") else: # Attempt to load the brain file. If it fails, fall back on the Reload # method. try: # The optional branFile argument specifies a brain file to load. kern.bootstrap(brainFile = "standard.brn") brainLoaded = True except: forceReload = True # Enter the main input/output loop. mqttc.on_connect=on_connect mqttc.on_message=on_message mqttc.subscribe("aiml",1) espeak.set_voice('id') espeak.set_parameter(3,10) espeak.synth("okay, saya siap") while mqttc.loop() == 0: time.sleep(.1) pass print "End of AIML"
from i3ipc.aio import Connection from i3ipc import Event import asyncio from espeak import espeak rate = 1 vol = 2 pitch = 3 rangE = 4 punctuation = 5 capitals = 6 wordgap = 7 # espeak default espeak.set_parameter(rate, 200) espeak.set_parameter(vol, 200) espeak.set_parameter(pitch, 30) espeak.set_parameter(wordgap, 30) # mbrola #espeak.set_voice('mb-en1') #espeak.set_parameter(rate, 180) #espeak.set_parameter(vol, 200) #espeak.set_parameter(pitch, 30) ##espeak.set_parameter(rangE, 30) #espeak.set_parameter(wordgap, 10) async def main(): def on_window(self, e): window_class = e.ipc_data["container"]["window_properties"]["class"] window_title = e.ipc_data["container"]["window_properties"]["title"]
def updatePunctuationLevel(self): """ Punctuation level changed, inform this speechServer. """ mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle] espeak.set_parameter(espeak.Parameter.Punctuation,mode,0)
def __init__(self,filename=None): self.guibuilder = gtk.Builder() self.guibuilder.add_from_file("/usr/share/lios/Gui/main.glade") self.window = self.guibuilder.get_object("window") self.textbuffer = self.guibuilder.get_object("textbuffer") self.textview = self.guibuilder.get_object("textview") self.image_frame = self.guibuilder.get_object("frame") self.progressbar = self.guibuilder.get_object("progressbar") self.random_label = self.guibuilder.get_object("random_label") self.random_spinbutton = self.guibuilder.get_object("random_spinbutton") self.random_entry = self.guibuilder.get_object("random_entry") self.random_label.hide() self.random_spinbutton.hide() self.random_entry.hide() self.textview.grab_focus() self.guibuilder.connect_signals(self) self.progressbar.set_pulse_step(.01) self.pulse = True #self.image = self.guibuilder.get_object("image") self.scrolledwindow_image = self.guibuilder.get_object("scrolledwindow_image") self.vruler = self.guibuilder.get_object("vruler") self.hruler = self.guibuilder.get_object("hruler") self.scrolledwindow_image.connect_object("motion_notify_event", self.motion_notify, self.hruler) self.scrolledwindow_image.connect_object("motion_notify_event", self.motion_notify, self.vruler) self.voice_list=[] for item in espeak.list_voices(): self.voice_list.append(item.name) for item in "scan_to_ui","ocr_pdf","ocr_folder","ocr_image","scan_and_ocr","scan_and_ocr_repeatedly","cam_scan","optimise_brightness","ocr_ui_image": self.guibuilder.get_object(item).connect("activate",self.run_process,item) ocr_ui_image_button = self.guibuilder.get_object("ocr_ui_image_button") ocr_ui_image_button.connect("clicked",self.run_process,"ocr_ui_image") ocr_selected_image_region_button = self.guibuilder.get_object("ocr_selected_image_region_button") ocr_selected_image_region_button.connect("clicked",self.run_process,"ocr_selected_image_region") scan_to_ui_button = self.guibuilder.get_object("scan_to_ui_button") scan_to_ui_button.connect("clicked",self.run_process,"scan_to_ui") #Preferences General_Preferences = self.guibuilder.get_object("General_Preferences") General_Preferences.connect("activate",self.preferences,0) Preferences_Recognition = self.guibuilder.get_object("Preferences_Recognition") Preferences_Recognition.connect("activate",self.preferences,1) Preferences_Scanning = self.guibuilder.get_object("Preferences_Scanning") Preferences_Scanning.connect("activate",self.preferences,2) Preferences_CamaraWebcam = self.guibuilder.get_object("Preferences_CamaraWebcam") Preferences_CamaraWebcam.connect("activate",self.preferences,3) #Getting Preferences Values self.read_preferences() #Init Keep Runner self.keep_running = False # Intiating thred in PyGtk gtk.threads_init() #Espeak And event espeak.set_parameter(espeak.Parameter.Rate,self.voice_message_rate) espeak.set_parameter(espeak.Parameter.Pitch,self.voice_message_pitch) espeak.set_parameter(espeak.Parameter.Volume,self.voice_message_volume) espeak.set_voice(self.voice_list[self.voice_message_voice]) espeak.set_SynthCallback(self.espeak_event) #Gnome-Canvas self.first_run = True self.canvas = gnomecanvas.Canvas(aa=True) self.dragging = False self.scrolledwindow_image.add(self.canvas) self.canvas.connect("event", self.canvas_event) self.set_image(self,data=None) self.canvas.show() self.window.maximize() #Reading Dictionarys self.key_value = {"eng" : "en","afr" : "af","am" : "am","ara" : "ar","ara" : "ar","bul" : "bg","ben" : "bn","br" : "br","cat" : "ca","ces" : "cs","cy" : "cy","dan" : "da","ger" : "de","ger" : "de","ell" : "el","eo" : "eo","spa" : "es","est" : "et","eu" : "eu","fa" : "fa","fin" : "fi","fo" : "fo","fra" : "fr","ga" : "ga","gl" : "gl","gu" : "gu","heb" : "he","hin" : "hi","hrv" : "hr","hsb" : "hsb","hun" : "hu","hy" : "hy","id" : "id","is" : "is","ita" : "it","kk" : "kk","kn" : "kn","ku" : "ku","lit" : "lt","lav" : "lv","mal" : "ml ","mr" : "mr ","dut" : "nl","no" : "no","nr" : "nr","ns" : "ns ","or" : "or ","pa" : "pa ","pol" : "pl ","por" : "pt","por" : "pt","por" : "pt","ron" : "ro","rus" : "ru ","slk" : "sk","slv" : "sl","ss" : "ss","st" : "st","swe" : "sv","tam" : "ta","tel" : "te","tl" : "tl","tn" : "tn","ts" : "ts","ukr" : "uk","uz" : "uz","xh" : "xh","zu" : "zu" } self.dict = enchant.Dict("%s" % self.key_value[self.language]) #Font pangoFont = pango.FontDescription(self.font) self.textview.modify_font(pangoFont) if (filename): self.textbuffer.set_text(open(filename,"r").read()) self.save_file_name = filename else: #Opening Recent Document try: recent_open = open("%srecent"%directory,'r') except IOError: pass else: recent_text = recent_open.read() self.textbuffer.set_text(recent_text) #Color self.highlight_tag = self.textbuffer.create_tag('Reading') self.textview.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color(self.font_color)) self.textview.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(self.background_color)) self.highlight_tag.set_property('foreground',gtk.gdk.Color(self.highlight_color)) self.highlight_tag.set_property('background',gtk.gdk.Color(self.background_highlight_color)) self.highlight_tag.set_property('font',self.highlight_font) #Welcome self.notify("Welcome To Linux-Intelligent-O.C.R-Solution",True,None,True) gobject.timeout_add(20, self.pulse_progressbar) #Placing cursor self.textbuffer.place_cursor(self.textbuffer.get_start_iter()) self.window.show() gtk.main()
import freenect import cv2 import numpy as np import time from espeak import espeak espeak.set_parameter(espeak.Parameter.Pitch, 60) espeak.set_parameter(espeak.Parameter.Rate, 110) espeak.set_parameter(espeak.Parameter.Range, 600) def get_video(): array, _ = freenect.sync_get_video() array = cv2.cvtColor(array, cv2.COLOR_RGB2BGR) return array def Detect(objectName, type): start = time.time() time.clock() elapsed = 0 seconds = 20 # 20 S. MIN_MATCH_COUNT = 30 try: setpath = '/home/uawsscu/PycharmProjects/project3/image/' + objectName + '.jpg' detector = cv2.SIFT() FLANN_INDEX_KDITREE = 0 flannParam = dict(algorithm=FLANN_INDEX_KDITREE, tree=5) flann = cv2.FlannBasedMatcher(flannParam, {}) trainImg = cv2.imread(setpath, 0)
def _init(self): self._current_voice_properties = {} mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle] espeak.set_parameter(espeak.Parameter.Punctuation, mode, 0)
import RPi.GPIO as GPIO from espeak import espeak import time from random import randint print 'Controlling LED test' led_pin = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(led_pin, GPIO.OUT) espeak.set_parameter(espeak.Parameter.Rate, 130) espeak.set_parameter(espeak.Parameter.Pitch, 60) try: while 1: print ("turn on led") espeak.synth("The light is on") GPIO.output(led_pin, GPIO.HIGH) time.sleep(randint(3,10)) print("turn off led") espeak.synth("The light is off") GPIO.output(led_pin, GPIO.LOW) time.sleep(5) except KeyboardInterrupt: GPIO.output(led_pin, GPIO.LOW) GPIO.cleanup() print 'done.'
mixer = pygame.mixer mixer.music.set_endevent( USEREVENT) #this event is triggered when the music ends hat = sense_hat.SenseHat() #the hat #implement settings (other than PATH) if SHUFFLE: import random if SPEAK: try: import espeak.espeak as espeak #espeak settings. may be in the SETTINGS section in the future espeak.set_parameter(7, 5) espeak.set_voice("en-us") except ImportError as e: print("Error: espeak import failed! " + str(e)) SPEAK = False #finally, the pipod object class Pipod(object): def __init__(self): print("This is Pipod") #basic start values self.state = "stop" self._volume = 100
# -*- coding: utf-8 -*- import RPi.GPIO as GPIO import time import argparse import glob import grp import os import pwd import re import keyboardleds from espeak import espeak espeak.set_voice("pt") espeak.set_parameter(7,5) TRIG = 16 ECHO = 18 RELE = 7 DISTANCIA = 200 ledkit='' def setupKeyLeds(): global ledkit event_device = glob.glob('/dev/input/by-path/*-event-kbd')[0] ledkit = keyboardleds.LedKit(event_device) uid = pwd.getpwnam('nobody').pw_uid gid = grp.getgrnam('nogroup').gr_gid
def web_socket_transfer_data(request): try: espeak.set_voice('spanish-latin-am') espeak.set_parameter(espeak.Parameter.Rate, 150) #arduino = serial.Serial('/dev/ttyACM0', 9600, timeout=3) arduino = serial.Serial('/dev/ttyUSB0', 9600, timeout=1) while True: line = request.ws_stream.receive_message() if line is None: return if arduino.inWaiting() > 0: sensorWord = arduino.readline() request.ws_stream.send_message("$" + sensorWord) if isinstance(line, unicode): dx, dy, sound = line.split(';') r, theta = polar(float(dx), float(dy)) speed, direction = polarToRobotCommands(r, theta) request.ws_stream.send_message(' / '.join( map(lambda x: str(x), [ dx, dy, round(r), round(theta, 1), speed, direction, sound ])), binary=False) if sound == 'd': subprocess.Popen(["aplay", "/home/pi/audio/dog_bark.wav"]) elif sound == 'h': subprocess.Popen([ "aplay", "/home/pi/audio/Ahooga_Car_Horn-SoundBible.com-1499602683.wav" ]) elif sound == 'L': subprocess.Popen( ["aplay", "/home/pi/audio/LucasGangnamClip.wav"]) elif sound == 'm': #os.system("amixer set PCM -- 100%") #subprocess.Popen(["amixer", "set", "PCM", "--", "100%", ";", "aplay", "/home/pi/audio/toodaloo.wav", ";", "amixer", "set", "PCM", "--", "80%"]) #subprocess.Popen(["aplay", "/home/pi/audio/toodaloo.wav"]) subprocess.Popen( ["/bin/sh", "/home/pi/audio/play_toodaloo.sh"]) #os.system("amixer set PCM -- 80%") elif sound == 't': arduino.write('e') arduino.write('f') elif sound.startswith('$'): message = sound.split('$') if (message[1] == 'shutdown'): os.system('sudo shutdown now') elif (message[1] == 'reboot'): os.system('sudo reboot') elif (message[1] == 'close_grip'): arduino.write('g') elif (message[1] == 'open_grip'): arduino.write('h') else: espeak.synth(message[1]) else: if direction == 'spin-right': arduino.write('9') elif direction == 'spin-left': arduino.write('8') elif direction == 'front' and speed == 'fast': arduino.write('1') elif direction == 'front' and speed == 'slow': arduino.write('2') elif direction == 'reverse' and speed == 'fast': arduino.write('5') elif direction == 'reverse' and speed == 'slow': arduino.write('4') elif direction == 'front-right': arduino.write('7') elif direction == 'front-left': arduino.write('6') else: arduino.write('3') # request.ws_stream.send_message('RPI received: %s' % line, binary=False) else: request.ws_stream.send_message(line, binary=True) finally: if arduino.isOpen(): arduino.close()
#!/usr/bin/python import wx import Image import time import os from espeak import espeak espeak.set_parameter(espeak.Parameter.Rate, 130) # 110 is kinda sloooow, 220 is very fast. os.environ['DISPLAY'] = ':0' fname='/tmp/gfi_box.png' def getImage(cntY=0): # startX and startY are ints for what line we are on. print "Running getImageCompare()" t = wx.App() # required, unused screen = wx.ScreenDC() bmp = wx.EmptyBitmap(160, 25) #abStartX=1050 # initial start X coordinate abStartY=164 # initial start Y coordinate ycoord = abStartY+(25*cntY) # move down per iteration of cntY mem = wx.MemoryDC(bmp) mem.Blit(0, 0, 160, 25, screen, 1050, ycoord) # get only the area we need del mem # Release image # save to file - don't like this but other options are Windows only bmp.SaveFile(fname, wx.BITMAP_TYPE_PNG) return True def getImageCompare(rows=0): getImage(rows)
def _set_volume(self, acss_volume): volume = self._percentToParam((acss_volume *10), minVolume, maxVolume) espeak.set_parameter(espeak.Parameter.Volume, volume, 0)
while True: try: yield s.receive() except scratch.ScratchError: raise StopIteration except KeyboardInterrupt: M1.stop() M2.stop() # Stop Ultrasonic trigger GPIO.cleanup() exit() # Robot Voice Settings espeak.set_voice("el") espeak.set_parameter(espeak.Parameter.Pitch, 30) espeak.set_parameter(espeak.Parameter.Rate, 80) espeak.set_parameter(espeak.Parameter.Range, 50) # Temperature sensor Setting # By default connnects to gpio4 therm_sensor = W1ThermSensor() GPIO.setmode(GPIO.BCM) # Ultrasonic sensor Settings trigger = 17 echo = 18 GPIO.setup(trigger, GPIO.OUT) GPIO.setup(echo, GPIO.IN) # Set trigger to False (Low)
def _set_volume(self, acss_volume): volume = self._percentToParam((acss_volume * 10), minVolume, maxVolume) espeak.set_parameter(espeak.Parameter.Volume, volume, 0)
def __init__(self, test=False): super(EspeakSounds, self).__init__() espeak.set_voice('en-us') if test: espeak.set_parameter(espeak.Parameter.Volume, 0) self.say("Ready.")
'no audio alerts available - Is gstreamer-1.0-tools installed?') GST_LIB_GOOD = False from qtvcp.core import Status from qtvcp.widgets.widget_baseclass import _HalWidgetBase # Instaniate the libraries with global reference # STATUS gives us status messages from linuxcnc STATUS = Status() ESPEAK = False try: from espeak import espeak import queue esQueue = queue.Queue() espeak.set_voice("m3") espeak.set_parameter(espeak.Parameter.Rate, 160) espeak.set_parameter(espeak.Parameter.Pitch, 1) ESPEAK = True except: LOG.warning( 'audio alerts - Is python3-espeak installed? (sudo apt install python3-espeak)' ) try: subprocess.check_output('''espeak --help''', shell=True) ESPEAK = True except: LOG.warning( 'audio alerts - Is espeak installed? (sudo apt install espeak)') LOG.warning('Text to speech output not available. ')
def _init(self): self._current_voice_properties = {} mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle] espeak.set_parameter(espeak.Parameter.Punctuation,mode,0)
msg = jimmy_servo() msg.servo_names.append(servo) msg.positions.append(position) pub.publish(msg) # rospy.spin() print "Message published!" def movegesture(gesture): pub = rospy.Publisher("jimmy_send_gesture", jimmy_gesture) r = rospy.Rate(10) msg = jimmy_gesture() msg.cmd = gesture pub.publish(msg) print "Gesture published" def listener(): rospy.init_node('listener', anonymous=True) rospy.Subscriber("conversation", String, callback) rospy.Subscriber("remote_speech", String, remote_say) rospy.spin() if __name__ == '__main__': try: espeak.set_parameter(espeak.Parameter.Rate,150) espeak.set_parameter(espeak.Parameter.Pitch,99) # espeak.set_parameter(espeak.Parameter.Wordgap,) espeak.set_voice("en") print "Ready to speak!" listener() except rospy.ROSInterruptException: pass
def __init__(self): espeak.set_voice("french+f5") espeak.set_parameter(espeak.Parameter.Wordgap, 1) espeak.set_parameter(espeak.Parameter.Rate, 50) espeak.set_parameter(espeak.Parameter.Pitch, 50)
def _set_pitch(self, acss_pitch): pitch = self._percentToParam((acss_pitch *10), minPitch, maxPitch) espeak.set_parameter(espeak.Parameter.Pitch, pitch, 0)
# Setup headset headset = epoc.EPOC(enable_gyro=False) headset.set_channel_mask(["O1", "O2", "P7", "P8"]) # Collect experiment information experiment = {} experiment['n_runs'] = n_runs experiment['freq_left'] = freq_left experiment['freq_right'] = freq_right experiment['channel_mask'] = headset.channel_mask experiment['block_size'] = 2 if sound_enabled: # Set TTS parameters espeak.set_parameter(espeak.Parameter.Pitch, 60) espeak.set_parameter(espeak.Parameter.Rate, 150) espeak.set_parameter(espeak.Parameter.Range, 600) # Equal amount of trials for each LED will be randomized cues = ["Left" for i in range(n_runs/2)] + ["Right" for i in range(n_runs/2)] random.shuffle(cues) random.shuffle(cues) experiment['cues'] = cues # Let classifier compute a PSD average over 2 second blocks p_conn.send(experiment) # Repeat n_runs time for i in range(experiment['n_runs']): # Give an auditory cue
def _set_rate(self, acss_rate): rate = self._percentToParam(acss_rate, minRate, maxRate) espeak.set_parameter(espeak.Parameter.Rate, rate, 0)
import time import RPi.GPIO as GPIO from time import strftime GPIO.setmode(GPIO.BOARD) from espeak import espeak espeak.set_parameter(15,True) speek=espeak.synth GPIO.setup(13, GPIO.OUT) open('1212.txt','w').close() while True: aa=open('1212.txt','r').read() c=[] c.append(aa) d=c[0].split() aaaaaaaa=0 z=[] for i in range(len(d)): z.append(d[aaaaaaaa].rstrip('s')) aaaaaaaa+=1 while 'hour' in z and 'minute' in z: try: c=[] aa=open('1212.txt','r').read() c.append(aa) d=c[0].split() aaaaaaaa=0 z=[]
def __init__(self): # self.engine = pyttsx.init() # self.engine.setProperty('voice', 'mb-fr1') # self.engine.setProperty('rate', 140) espeak.set_voice('mb-fr1') espeak.set_parameter(1, 140) # 1 represents the speed of the voice
def updatePunctuationLevel(self): """ Punctuation level changed, inform this speechServer. """ mode = self._PUNCTUATION_MODE_MAP[settings.verbalizePunctuationStyle] espeak.set_parameter(espeak.Parameter.Punctuation, mode, 0)
def say(self, message): from espeak import espeak espeak.set_parameter(espeak.Parameter.Pitch, 5) espeak.set_parameter(espeak.Parameter.Rate, 150) espeak.synth(message)
#robo = Turtle() #robo.up() import math from playercpp import * import subprocess from espeak import espeak ################################################################################### #########INICIALICACAO DOS DEVICES DO ROBO######################################### ################################################################################### espeak.set_voice('pt') espeak.set_parameter(espeak.Parameter.Rate, 140) espeak.synth('Ola, Bem Vindo ao Logo interpretador') var = dict({}) #cria o cliente e conecta c = PlayerClient('localhost', 6666) #criando proxy para position2d:0 :) p = Position2dProxy(c,0) #pega a geometria do device p.RequestGeom() #cria proxy pro speech:0 s = SpeechProxy(c,0)
import time import serial from espeak import espeak from gpiozero import Button prev = Button(3) pause = Button(4) ser = serial.Serial("/dev/ttyUSB0", 9600) espeak.set_parameter(espeak.Parameter.Rate, 100) time.sleep(2) myfile = open("/home/pi/mysample.txt" , "r") data = "" lines = myfile.readlines() ser.write('%') for line in lines: data = data + line.strip(); for words in lines: successful = False while not successful: for letters in words: if (prev.is_pressed == True): print('Pressed') time.sleep(0.25) continue if (letters==" "): ser.write('%') time.sleep(0.8) continue if (letters=="0" or letters=="1" or letters=="2" or letters=="3" or letters=="4" or letters=="5" or letters=="6" or letters=="7" or letters=="8" or letters=="9"): print(letters)
def _set_pitch(self, acss_pitch): pitch = self._percentToParam((acss_pitch * 10), minPitch, maxPitch) espeak.set_parameter(espeak.Parameter.Pitch, pitch, 0)