def speek(text, lcd=True, english=False, dummy=None):
     '''
     Speek text
     '''
     if dummy == None:
         thread.start_new_thread(DO.speek, (text, lcd, english, "",)) 
     else:
         #sleep = False
         #if LOOP.last_speek == None:
         #    sleep = True
         #LOOP.last_speek = time.time()
         #IO.UNITS.speeker(True)
         #if sleep:
         #    time.sleep(5)
         t = len(text)/10
         if t < 1:
             t = 0.8
         if english:
             espeak.set_voice("en+f5")
         else:
             espeak.set_voice("sv+f5")
         espeak.synth(text)
         if lcd:
             lmatrix.animate_speak(t, leav_this=lmatrix.matrix_smile)
             lmatrix.clear(10)
示例#2
0
    def load_map(self, language_with_code):
        self.language = language_with_code.split("-")[0]
        espeak.set_voice(language_with_code.split("-")[1])
        print("loading Map for language : %s" % self.language)
        self.map = {}
        submap_number = 1
        self.append_sub_map("beginning.txt", submap_number)
        submap_number = 2
        self.append_sub_map("middle.txt", submap_number)
        submap_number = 3
        self.append_sub_map("punctuations.txt", submap_number)

        # Contraction dict
        self.contractions_dict = {}

        # load each contractions to map
        for text_file in os.listdir("%s/braille/%s/" % (data_dir, self.language)):
            if text_file not in [
                "beginning.txt",
                "middle.txt",
                "abbreviations.txt",
                "abbreviations_default.txt",
                "punctuations.txt",
                "help.txt",
            ]:
                if self.simple_mode == 0 and "~" not in text_file:
                    submap_number += 1
                    self.append_sub_map(text_file, submap_number)
                    self.contractions_dict[text_file[:-4]] = submap_number - 1

                    # Load abbreviations if exist
        self.load_abbrivation()
        espeak.synth("{} Loaded!".format(self.language))
示例#3
0
 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)
示例#4
0
	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 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();
示例#6
0
    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!"
示例#7
0
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
示例#8
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
示例#9
0
文件: go.py 项目: bqlabs/golem
def golem(speaker=False):
    espeak.set_voice('spanish')
    golem = Golem()
    config(golem)
    speak('Me llamo %s' % golem.id.name)
    while True:
        try:
            audio_recorder.record_to_file(wav_file_path)
            text = wav_to_text(wav_file_path)
        except GolemException:
            pass
        except KeyboardInterrupt:
            break
    audio_recorder.close()
示例#10
0
 def _set_family(self, acss_family):
     familyLocale = acss_family.get(speechserver.VoiceFamily.LOCALE)
     familyDialect = acss_family.get(speechserver.VoiceFamily.DIALECT)
     if familyDialect:
         identifier = '-'.join((familyLocale,familyDialect))
     if not familyLocale:
         import locale
         familyLocale, encoding = locale.getdefaultlocale()
     if familyLocale:
         identifier = familyLocale
     if identifier:
         espeak.set_voice(identifier)
     else:
         name = acss_family.get(speechserver.VoiceFamily.NAME)
         if name != self._default_voice_name:
             espeak.set_voice(name)
示例#11
0
文件: atajos.py 项目: unrblt/pilas
def leer(texto, esperar = False):
    """Utiliza el comando speak para 'leer' un texto como sonido.

    :param texto: Cadena de texto a pronunciar.
    :param esperar: Si es True la función no vuelve hasta que se termina de leer el texo.
    :type esperar: boolean
    """
    try:
        from espeak import espeak
        import time
        espeak.set_voice('es-la')
        espeak.synth(texto)
        while esperar and espeak.is_playing():
            time.sleep(1)
    except ImportError:
        pass
示例#12
0
	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)
示例#13
0
	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)
示例#14
0
文件: ESpeak.py 项目: tkurbad/torbot
    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
@license: GNU Lesser General Public License v2.1
@change: 2016-03-13 Created
'''


import steelsquid_utils
import steelsquid_pi
import steelsquid_kiss_global
import steelsquid_nm
import steelsquid_kiss_boot
import time
import datetime
import steelsquid_hmtrlrs
from decimal import Decimal
from espeak import espeak
espeak.set_voice("sv+f5")

# Is this module started
# This is set by the system automatically.
is_started = False


def enable(argument=None):
    '''
    When this module is enabled what needs to be done (execute: steelsquid module XXX on)
    Maybe you need create some files or enable other stuff.
    argument: Send data to the enable or disable method in the module
              Usually a string to tell the start/stop something
    '''
    # Clear any saved settings for this module
    steelsquid_kiss_global.clear_modules_settings("kiss_squidrover")
示例#16
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.")
# -*- coding: utf-8 -*-
# Run with Python 2
from espeak import espeak
import pygame, sys, time
from pygame.locals import *

done = False

espeak.set_voice( "eo" )

pygame.init()
fpsClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode( ( 640, 480 ) )
pygame.display.set_caption( "Esperantisto" )

background = pygame.image.load( "sei.chan_classroom.png" )
person = pygame.image.load( "annako_zero.png" )

font = pygame.font.Font( "PressStart2P.ttf", 16 )

thingsToSay = [ 
"Saluton!",
"Cxu vi sxatas min?",
"Kiel vi fartas?",
"Mi fartas bone!",
]

index = 0
 

while ( done == False ):
示例#18
0
    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
示例#19
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
示例#20
0
        LOG.warning(
            '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. ')
示例#21
0
#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
示例#22
0
 def say_espeak(self, text, priority='important'):
     '''speak some text using espeak'''
     from espeak import espeak
     if self.settings.speech_voice:
         espeak.set_voice(self.settings.speech_voice)
     espeak.synth(text)
示例#23
0
def read_cred(file):
    in_handle = open(file,'r')
    cred = {}
    for ln in in_handle:
        data = ln.strip('\r\n').split('=')
        if len(data) > 1:
            key = data[0].strip(' ').lower()
            value = data[1].strip(' ')
            cred[key] = value
        else:
            print "error in parsing credentials file"
    return cred


espeak.set_voice("f1") # female


cred = read_cred(sys.argv[1])

class MyStreamer(TwythonStreamer):
    def on_success(self, data):
    act(data)

    def on_error(self, status_code, data):
        print status_code, data


stream = MyStreamer(cred['consumer_key'], cred['consumer_secret'],
                    cred['access_token_key'], cred['access_token_secret'])
示例#24
0
def speak():
    print('é faixa')
    espeak.set_voice('pt')
    espeak.speed = 1
    espeak.synth("é faixa de pedestre")
    time.sleep(1)
示例#25
0
    def __init__(self):
        self.__gender = 'F'

        #preserve default even when someone forgets to call initialize():
        espeak.set_voice('female2')
示例#26
0
# sudo apt install python3-espeak

from espeak import espeak
from ina219 import INA219, DeviceRangeError
from time import sleep

SHUNT_OHMS = 0.1  # Resistencia do resistor de shunt do circuito INA219
MAX_EXPECTED_AMPS = 0.3  # Corrente máxima esperada para medição
ina = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS)
ina.configure(ina.RANGE_16V)

espeak.set_voice("brazil")  # Configura espeak para sintetizar em pt-br

# Variaveis strings de parametros medidos pelo INA219
sTensao_int = ""
sTensao_dec = ""
sTensao_sinal = ""

sCorrente_int = ""
sCorrente_dec = ""
sCorrente_sinal = ""


# Sintetiza string "texto", adicionando uma pausa "delay_ms" no final
def falar(texto, delay_ms):
    espeak.synth(texto)
    while espeak.is_playing():
        pass
    sleep(delay_ms / 1000)

 def speak(self, speakStr):
     """Takes in a string and "speaks" it to the base station and also to the  robot's computer."""
     espeak.set_voice("english-us", gender=2, age=10)
     espeak.synth(speakStr)  # nodeNum, nodeCoord, heading = matchInfo
     self.pub.publish(speakStr)
示例#28
0
def idioma(data):
    global lang
    espeak.set_voice(data.data)
    lang = data.data
示例#29
0
文件: demo.py 项目: eclubiitk/ZIZO101
        espeak.synth(g)
        
        sleep((spaces+1)/3)
        arduino.write('q')
                   

               

    
# Create two threads as follows
try:
    #thread.start_new_thread( face_tracking,() )
    #thread.start_new_thread( twitter,() )
    sleep(.5)
    arduino.write('a')
    espeak.set_voice('hindi')
    
    
    g='Hi I am zizo one oh one. I am a social robot. I can interact with people and track them. I can show various expressions like sadness, anger happiness etc. '
    i=0
    spaces=0
    while(i<len(g)):
        if g[i]==' ':
            spaces=spaces+1
        i=i+1
    
    arduino.write('p')
    espeak.synth(g)
    sleep((spaces+1)/3)
    arduino.write('q')
    
示例#30
0
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()
示例#31
0
文件: sensor.py 项目: naylor/QuoICE
# -*- 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
示例#32
0
# -*- coding: utf-8 -*-
from espeak import espeak

# Install espeak in Ubuntu with
# sudo apt-get instll espeak
# sudo apt-get install python-espeak

# Find the version installed by checking the lib file
# ls /usr/lib/x86_64-linux-gnu/libespeak.so.*
# Or by checking the apt package info
# apt-cache show espeak

# download the full Russian language pack from
# http://espeak.sourceforge.net/data/
# and unzip it and replace the existing russian pack in
# /usr/share/doc/espeak-data

espeak.set_voice("ru")

# Python2 files must be marked # -*- coding: utf-8 -*-
espeak.synth("где папа")
while espeak.is_playing:
	pass
示例#33
0
#!/usr/bin/env python3
# Requires PyAudio and PySpeech.

import speech_recognition as sr
from espeak import espeak

# Record Audio
m = sr.Microphone()
r = sr.Recognizer()
espeak.set_voice("es")

# Speech recognition using Google Speech Recognition
while True:
    try:
        # for testing purposes, we're just using the default API key
        # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
        # instead of `r.recognize_google(audio)`
        with m as source:
            r.adjust_for_ambient_noise(source)
        print("Say something!")
        with m as source:
            audio = r.listen(source)
        print("Got it! Now to recognize it...")
        print("You said: " + r.recognize_google(audio))
        espeak.synth(r.recognize_google(audio))
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print(
            "Could not request results from Google Speech Recognition service; {0}"
            .format(e))
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 14 00:31:42 2014

@author: Administrator
"""
#import comunicazione_arduino  
import wx,os,time
from pygame import mixer
import threading,serial 
import random
#import wx,os,speech #speech only supported on windows machines 
#import wx.lib.inspection
from PIL import Image, ImageDraw
from espeak import espeak
espeak.set_voice('it')

try:
    package_directory = os.path.dirname(os.path.abspath(__file__))
    cartella_esercizi = os.path.join(package_directory, 'ESERCIZI')
except:
    pass

SERIALRX = wx.NewEventType()
# bind to serial data receive events
EVT_SERIALRX = wx.PyEventBinder(SERIALRX, 0)

class SerialRxEvent(wx.PyCommandEvent):
    eventType = SERIALRX
    def __init__(self, windowID, data):
        wx.PyCommandEvent.__init__(self, self.eventType, windowID)
示例#35
0
import RPi.GPIO as GPIO
import time
from espeak import espeak
from threading import Timer, Thread, Event
import threading

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # Recebe as oscilacoes
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # Reseta
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # Total voltas

espeak.set_voice('brazil')
espeak.set_parameter(espeak.Parameter.Rate, 175, 0)
GPIO.setup(26, GPIO.OUT)

cont = 0
cont_total = 0


# Encontrando a frequência de rotação
def frequencia():
    global cont, cont_total
    GPIO.wait_for_edge(20, GPIO.RISING)
    t_inicio = time.time()
    GPIO.wait_for_edge(20, GPIO.RISING)
    t_fim = time.time()
    tempo = t_fim - t_inicio  # Tempo de uma rotacao
    freq = 1 / tempo
    cont = cont + 2
示例#36
0
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
        self.volume = self._volume
示例#37
0
 def say_espeak(self, text, priority='important'):
     '''speak some text using espeak'''
     from espeak import espeak
     if self.settings.speech_voice:
         espeak.set_voice(self.settings.speech_voice)
     espeak.synth(text)
示例#38
0
文件: speech.py 项目: EbaCorp/vega
"""Speech Utilities.

This module is responsible for any speech-to-text or text-to-speech
interactions with outer APIs/services.
"""

from subprocess import call
import time

from espeak import espeak
from espeak import core as espeak_core

SPEECH_SPEED = 30  # words per minute

espeak.set_parameter(espeak.Parameter.Rate, SPEECH_SPEED, False)
espeak.set_voice("ru")  # Russian language interface


class Speech():
    """Method for audio output.
    
    We are passing data to outer RESTful API, then getting back response.
    Response is being synthesized. User hears output as an audio.
    """
    @staticmethod
    def say(*args):
        done_synth = [False]

        def cb(event, pos, length):
            if event == espeak_core.event_MSG_TERMINATED:
                done_synth[0] = True
	print()

	if ( choice == 1 ):
		print( "VOICES" )
		voices = espeak.list_voices()

		print( "Identifier","Name","Gender","Age","Variant" )
		for voice in voices:
			print( "Name: 			", voice.name )
			print( "Identifier: 		", voice.identifier )
			print( "Gender: 		", voice.gender )
			print( "Age: 			", voice.age )
			print( "Variant: 		", voice.variant )
			print()

	elif ( choice == 2 ):
		print( "SPEAK" )
		voice = input( "What voice do you want to use? >> " )
		espeak.set_voice( voice )

		text = input( "What do you want to say? >> " )
		print( "Saying \"" + text + "\"" )
		espeak.synth( text )

	elif ( choice == 3 ):
		print( "FUNCTIONS" )
		for member in dir( espeak ):
			print( member )

# Run with Python 3
from espeak import espeak
import sys

done = False

espeak.set_voice( "zh" )

print( "Pinyin Pronouncer" )
print( "1: -" )
print( "2: /" )
print( "3: v" )
print( "4: \\" )
print( "5: neutral" )
print( "No # defaults to 1st tone" )
print( "-------------------------" )    

while ( done == False ):
    text = input( "Text: " )
    espeak.synth( text )
    print()
示例#41
0
文件: cpaiml.py 项目: irzaip/cipi
		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"

 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)
示例#43
0
			sendurl('LED1=ON', "J'ai allumé la petite lampe de la chambre")

		if val_On_Off == 'off':
			sendurl('LED1=OFF', "J'ai éteint la petite lampe de la chambre")
				
	if intent == 'lustre_chambre':
		if  val_On_Off == 'on':
			sendurl('LEDA=ON', "J'ai allumé le lustre de la chambre")

		if val_On_Off == 'off':
			sendurl('LEDA=OFF', "J'ai éteint le lustre de la chambre")

    ecoute(2)

# Fonction envoie de l'URL
def sendurl(arg, texte): # arg argument passé à la requete URL, Texte = Texte parole suivant commande
	url = 'http://192.168.0.34/?' + arg
	request = urllib.urlopen(url)
	parole(texte)

# Connexion du signal à notre fonction
signal.signal(signal.SIGINT, fermer_programme)
	
espeak.set_voice('fr', '', 1, 0, 0) # Initialisation language
parole("Je me prépare")	
wit.init() #Lancement de wit

# Mise en route et lancement de l'écoute	
ecoute(1)

# configuration
enable_cheerlights = True

# print('Initiate Sense Hat')
sense = SenseHat()
sense.low_light = False
sense.load_image("jaffar.png")

# add a backgroudn thread to flip image horizonally
thread1 = threading.Thread(target=flip_image_horizontally)
thread1.start()

# print('Initiate TTS')
#espeak.set_voice("en-us+f5") # female's voice
espeak.set_voice("en-us+m3")  # male's voice
speak("Initiate Jaffar's Pi Bot!")

# print('Set up tweepy')
with open('twitter_auth.json') as file:
    secrets = json.load(file)

# print('Authenticate the access token')
auth = tweepy.OAuthHandler(secrets['consumer_key'], secrets['consumer_secret'])
auth.set_access_token(secrets['access_token'], secrets['access_token_secret'])
twitter = tweepy.API(auth)

# Start the program loop
command = ''
while command != 'e':
    # print('Setting up greeters')
示例#45
0
def texto(data):
    global lang
    espeak.set_voice(lang)
    espeak.synth(data.data)
示例#46
0
from espeak import espeak

espeak.set_voice("ru")
espeak.synth("где хакер")

while espeak.is_playing:
    pass

示例#47
0
import RPi.GPIO as GPIO  # Import Raspberry Pi GPIO library
import sys
import time
import subprocess
import os
import signal
import alsaaudio
from datetime import datetime
from subprocess import check_output
from espeak import espeak

#----------------------------------
# German Language
# de+12 de+13
#----------------------------------
espeak.set_voice("de+13")

#----------------------------------
# Volume Settings
#----------------------------------
m = alsaaudio.Mixer('PCM')
current_volume = m.getvolume()  # Get the current Volume
print(current_volume)
vol = 100
m.setvolume(vol)  # Set the volume to 70%.
#----------------------------------
# Switch and Light pin
#----------------------------------

sw1 = 37
sw2 = 35
示例#48
0
# https://zerozeroonezeroonezeroonezero.wordpress.com
#

import numpy as np
import cv2
import time
from pyfirmata import Arduino, util
from espeak import espeak

board = Arduino(
    '/dev/ttyUSB0')  # mit Arduino-IDE überprüfen, ob das der USB-Anschluss ist

richtungsausgabe = False
zeit = time.time()

espeak.set_voice("de")

espeak.synth("bitte einen Moment warten")


def stop():
    board.digital[8].write(0)  #Motorrichtung A beide Pins
    board.digital[9].write(0)
    board.digital[10].write(0)  #Motorrichtung B beide Pins
    board.digital[11].write(0)
    time.sleep(1)


# in diesen Funktionen werden die Motoren angeschaltet - diesmal über Relais, nicht mehr H-Brücke
def motoren(richtung):
    if richtung == "B":
示例#49
0
#ungueltig=0

#print("START")
#for p in people:
 #   email=p["Email"]
  #  email_split=email.split('@')
   # if((email != "") and (len(email_split)>1)):
 #       print(email)
   # else:
     #   print("!!!! Üngültige Email Gefunden = " + email)
    #    ungueltig+=1

#print("Total: "+str(ungueltig))
#######################################################################################################################################################

espeak.set_voice('de')


#######################################################################################################################################################
print("\n\n\n#schiefahren nummern\n\n\n")

schifahren_kinder_liste=[]
schifahren_eltern_tele_liste=[]

for p in people:
    if p['Geburtsdatum']!='' and p['schifahren'].lower()=='ja':
        schifahren_kinder_liste.append(p["Name"])
    else:
        #print(p)
        hallo=p["Telefon"]
        if p['schifahren']!='' and p['schifahren'].lower()=='ja':
示例#50
0
#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