本文整理汇总了Python中sound_play.libsoundplay.SoundClient类的典型用法代码示例。如果您正苦于以下问题:Python SoundClient类的具体用法?Python SoundClient怎么用?Python SoundClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoundClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: callback
def callback(self, msg):
if msg.min_distance < 2.0:
soundhandle = SoundClient()
rospy.sleep(rospy.Duration(1))
soundhandle.playWave(self.sound)
rospy.sleep(rospy.Duration(2))
soundhandle.stopAll()
开发者ID:cdondrup,项目名称:christmas,代码行数:7,代码来源:santa.py
示例2: main
def main():
rospy.init_node(NAME)
# Init Globals with their type
global status_list
status_list = []
global cant_reach_list
cant_reach_list = []
global actionGoalPublisher
# Speech stuff
global soundClient
soundClient = SoundClient()
init_point2pont()
actionStatus = rospy.Subscriber('move_base/status', GoalStatusArray, status_callback)
actionGoalPublisher = rospy.Publisher('move_base/goal', MoveBaseActionGoal, queue_size=10)
frontierSub = rospy.Subscriber('grid_frontier', GridCells, frontier_callback)
rospy.wait_for_message('grid_frontier', GridCells)
rospy.sleep(1)
driveTo.goalID = getHighestStatus()
soundClient.say("Starting Driving")
global closestGoal
while not rospy.is_shutdown():
rospy.loginfo("Waiting for a little while")
rospy.sleep(2) #Allow the goal to be calculated
rospy.loginfo("Getting the closest goal")
closesGoalCopy = getClosestGoal(2)
rospy.loginfo("Getting the current location")
driveTo(closesGoalCopy[0], closesGoalCopy[1], closesGoalCopy[2])
rospy.spin()
开发者ID:DragonShadesX,项目名称:rbe_3002,代码行数:34,代码来源:robot_control.py
示例3: __init__
class TalkBack:
def __init__(self, script_path):
rospy.init_node('talkback')
rospy.on_shutdown(self.cleanup)
self.voice = rospy.get_param("~voice", "voice_don_diphone")
self.wavepath = rospy.get_param("~wavepath", script_path + "/../sounds")
self.soundhandle = SoundClient()
rospy.sleep(1)
self.soundhandle.stopAll()
self.soundhandle.playWave(self.wavepath + "/R2D2a.wav")
rospy.sleep(1)
self.soundhandle.say("Ready", self.voice)
rospy.loginfo("Say one of the navigation commands...")
rospy.Subscriber('/recognizer/output', String, self.talkback)
def talkback(self, msg):
palabra = msg.data
rospy.loginfo(palabra)
if (palabra == "cancel"):
rospy.loginfo("The number is one")
self.soundhandle.say(msg.data, self.voice)
def cleanup(self):
self.soundhandle.stopAll()
rospy.loginfo("Shutting down talkback node...")
开发者ID:Ortega-R94,项目名称:donaxi_arm_2,代码行数:26,代码来源:numbers.py
示例4: __init__
class VoiceGenerator:
def __init__(self):
rospy.on_shutdown(self.cleanup)
#self.voice = rospy.get_param("~voice", "voice_kal_diphone")
self.voice = rospy.get_param("~voice", "voice_don_diphone")
self.wavepath = rospy.get_param("~wavepath", "")
self.topic = rospy.get_param("~voice_topic", "")
# Create the sound client object
self.soundhandle = SoundClient()
rospy.sleep(1)
self.soundhandle.stopAll()
# Announce that we are ready for input
rospy.sleep(1)
self.soundhandle.say("Voice Module Ready", self.voice)
rospy.loginfo("Message ...")
# Subscribe to the recognizer output
rospy.Subscriber(self.topic, String, self.voicegenerator)
def switch_asr_onoff_client(self, x):
rospy.wait_for_service('switch_asr_on_off')
try:
switch_asr_on_off = rospy.ServiceProxy('switch_asr_on_off', asr_status)
resp1 = switch_asr_on_off(x)
except rospy.ServiceException, e:
print "Service call failed: %s"%e
开发者ID:Robotica-ule,项目名称:MYRABot,代码行数:32,代码来源:voice_component.py
示例5: __init__
class Voice:
def __init__(self, sound_db):
self._sound_client = SoundClient()
rospy.loginfo('Will wait for a second for sound_pay node.')
rospy.sleep(1)
self._sound_db = sound_db
self.play_sound('sound10')
def play_sound(self, sound_name):
'''Plays the requested sound.
Args:
requested_sound (str): Unique name of the sound in the sound database.
'''
sound_filename = self._sound_db.get(sound_name)
self._sound_client.playWave(sound_filename)
# TODO: Make sure this returns when it is done playing the sound.
def say(self, text):
'''Send a TTS (text to speech) command.
Args:
text (str): The speech to say.
'''
self._sound_client.say(text)
开发者ID:mayacakmak,项目名称:robot_eup,代码行数:25,代码来源:voice.py
示例6: callback
def callback(data):
if str(data) == "data: Bark":
soundhandle = SoundClient()
rospy.sleep(1)
soundhandle.play(1)
pubshoot = rospy.Publisher('bark', String)
pubshoot.publish(String("Fire"))
开发者ID:rogeriocisi,项目名称:carro-autonomo,代码行数:7,代码来源:barky.py
示例7: __init__
class Talker:
def __init__(self):
#self.talkPublisher = rospy.Publisher("/robotsound", SoundRequest, queue_size=1)
self.soundClient = SoundClient()
rospy.sleep(1)
def say(self, text):
self.soundClient.say(text, 'voice_kal_diphone')
开发者ID:ab3nd,项目名称:DrinkBot,代码行数:8,代码来源:dispenser_control.py
示例8: SoundIntermediary
class SoundIntermediary():
def __init__(self):
self.sound_client = SoundClient()
self.voice = rospy.get_param("~voice", "kal_diphone")
rospy.Subscriber("wt_speech", String, self.speak)
def speak(self, msg):
self.sound_client.say(msg.data, self.voice)
开发者ID:gt-ros-pkg,项目名称:hrl-assistive,代码行数:8,代码来源:speech_intermediary.py
示例9: execute
def execute(self, userdata):
soundhandle = SoundClient()
#let ROS get started...
rospy.sleep(0.5)
soundhandle.stopAll()
return succeeded
开发者ID:jypuigbo,项目名称:robocup-code,代码行数:9,代码来源:play_sound_sm.py
示例10: TtsServer
class TtsServer(object):
feedback = TtsFeedback()
result = TtsResult()
def __init__(self, name):
self._action_name = name
self._as = actionlib.SimpleActionServer(self._action_name, TtsAction, self.execute_cb, auto_start = False)
self._as.start()
self.client = SoundClient()
rospy.sleep(1)
self.client.stopAll()
rospy.loginfo("Started ActionServer")
def execute_cb(self, goal):
self.feedback.event_type = 1
self.feedback.timestamp = rospy.get_rostime()
self._as.publish_feedback(self.feedback)
goalString = goal.rawtext.text
self.result.text = goalString
self.result.msg = "This string can be used to display an eventual error or warning message during voice synthesis"
rospy.sleep(goal.wait_before_speaking)
# self.client.say(goalString)
words = goalString.split()
self.sayWords(words)
self._as.set_succeeded(self.result)
self.feedback.event_type = 2
self.feedback.timestamp = rospy.get_rostime()
self._as.publish_feedback(self.feedback)
def sayWords(self, words):
i = 0
self.feedback.event_type = 32
for word in words:
self.client.say(word)
self.feedback.text_said = word
if(i<len(words)-1):
self.feedback.next_word = words[i+1]
else:
self.feedback.next_word = "Reached the end of the sentence"
self.feedback.event_type = 128
self.feedback.timestamp = rospy.get_rostime()
self._as.publish_feedback(self.feedback)
i += 1
rospy.sleep(0.7)
del words[:]
开发者ID:rizasif,项目名称:Robotics_intro,代码行数:56,代码来源:tts_to_soundplay.py
示例11: __init__
class FestivalTTS:
def __init__(self):
rospy.init_node('festival_tts')
self._client = SoundClient()
self.voice = 'voice_cmu_us_slt_arctic_hts'
rospy.Subscriber('festival_tts', String, self._response_callback)
rospy.spin()
def _response_callback(self, data):
self._client.say(data.data, self.voice)
开发者ID:hcrlab,项目名称:push_pull,代码行数:10,代码来源:speak.py
示例12: play_nonblocking
def play_nonblocking():
"""
Play the same sounds with manual pauses between them.
"""
rospy.loginfo('Example: Playing sounds in *non-blocking* mode.')
# NOTE: you must sleep at the beginning to let the SoundClient publisher
# establish a connection to the soundplay_node.
soundhandle = SoundClient(blocking=False)
rospy.sleep(1)
# In the non-blocking version you need to sleep between calls.
rospy.loginfo('Playing say-beep at full volume.')
soundhandle.playWave('say-beep.wav')
rospy.sleep(1)
rospy.loginfo('Playing say-beep at volume 0.3.')
soundhandle.playWave('say-beep.wav', volume=0.3)
rospy.sleep(1)
rospy.loginfo('Playing sound for NEEDS_PLUGGING.')
soundhandle.play(SoundRequest.NEEDS_PLUGGING)
rospy.sleep(1)
rospy.loginfo('Speaking some long string.')
soundhandle.say('It was the best of times, it was the worst of times.')
开发者ID:78226415,项目名称:audio_common,代码行数:25,代码来源:soundclient_example.py
示例13: Robbie_Chat
class Robbie_Chat():
def __init__(self):
rospy.init_node('robbie_chat_node', anonymous=True)
self.kern = aiml.Kernel()
self.kern.setBotPredicate("name","robbie")
self.kern.setBotPredicate("location","Australia")
self.kern.setBotPredicate("botmaster","Petrus")
self.kern.setBotPredicate("gender","male")
self.brainLoaded = False
self.forceReload = False
# Set the default TTS voice to use
self.voice = rospy.get_param("~voice", "voice_don_diphone")
self.robot = rospy.get_param("~robot", "robbie")
# Create the sound client object
self.soundhandle = SoundClient()
# Wait a moment to let the client connect to the
# sound_play server
rospy.sleep(1)
# Make sure any lingering sound_play processes are stopped.
self.soundhandle.stopAll()
while not self.brainLoaded:
if self.forceReload or (len(sys.argv) >= 2 and sys.argv[1] == "reload"):
# Use the Kernel's bootstrap() method to initialize the Kernel. The
# optional learnFiles argument is a file (or list of files) to load.
# The optional commands argument is a command (or list of commands)
# to run after the files are loaded.
#self.kern.setBotPredicate(name. robbie)
self.kern.bootstrap(learnFiles="std-startup.xml", commands="load aiml b")
self.brainLoaded = True
# Now that we've loaded the brain, save it to speed things up for
# next time.
self.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.
self.kern.bootstrap(brainFile = "standard.brn")
self.brainLoaded = True
except:
self.forceReload = True
rospy.Subscriber('/speech_text', String, self.speak_text)
def speak_text(self, text):
self.soundhandle.say(self.kern.respond(text.data), self.voice)
开发者ID:JanMichaelQuadrant16,项目名称:robo_hand_01,代码行数:54,代码来源:test2.py
示例14: __init__
def __init__(self):
if debug:
print "Initializing Sound Client"
SoundClient.__init__(self)
# wait for subscribers
timeout = 10
while timeout > 0:
if self.pub.get_num_connections() > 0:
timeout = 0
else:
rospy.sleep(1)
开发者ID:PR2,项目名称:pr2_hack_the_future,代码行数:11,代码来源:pr2_simple_interface.py
示例15: main
def main():
rospy.init_node('eys_move', anonymous = True)
soundhandle = SoundClient()
close_eye_publisher = rospy.Publisher("close_eye", Int32, queue_size=10)
rospy.sleep(1)
soundhandle.stopAll()
close_eye_publisher.publish(Int32(data=2))
wave_path = os.path.dirname(os.path.abspath(__file__)) + "/../sounds/camera.wav"
soundhandle.playWave(wave_path)
sleep(2)
开发者ID:TKatayama,项目名称:eye_see,代码行数:12,代码来源:sample.py
示例16: __init__
class ChatbotSpeaker:
def __init__(self):
rospy.init_node('chatbot_speaker')
self._client = SoundClient()
rospy.Subscriber('chatbot_responses', String, self._response_callback)
rospy.spin()
def _response_callback(self, data):
query = urllib.quote(data.data)
os.system(tts_cmd.format(query))
os.system(sox_cmd)
self._client.playWave('/tmp/speech.wav')
开发者ID:MarcelGabriel1993,项目名称:chatbot,代码行数:12,代码来源:speak.py
示例17: wel
def wel(filename):
#absolute path for this
print filename
fileloc = str( str(os.path.dirname(__file__)) +'/'+ filename)
f = open(fileloc, 'r')
#rospy.init_node('say', anonymous = True)
soundhandle = SoundClient()
rospy.sleep(1)
s = f.read()
print s
soundhandle.say(s,'voice_kal_diphone')
#may be loop with readline so there is a pause at every line.
rospy.sleep(1)
开发者ID:emreozanalkan,项目名称:ASMA,代码行数:13,代码来源:welcome.py
示例18: SaySomething
class SaySomething(object):
def __init__(self, speech):
self._speech = speech
self._client = SoundClient()
def start_goal(self):
self._client.say(self._speech, 'voice_us1_mbrola')
def start(self):
pass
def stop(self):
pass
开发者ID:jstnhuang,项目名称:trigger_action_programming,代码行数:13,代码来源:say_something.py
示例19: __init__
def __init__(self):
State.__init__(self, outcomes=['detect','not_detect'])
rospy.Subscriber("ar_pose_marker", AlvarMarkers, self.my_listener)
self.n_markers = 0
self.table_flag = False
self.execute_flag = False
self.sum_x = 0
self.counter = 0
self.mean_distance = 0
soundhandle = SoundClient()
self.detect_tableorder = soundhandle.waveSound('/home/mscv/ros/hydro/catkin_ws/src/rbx2/rbx2_tasks/sound/smb_1-up.wav')
开发者ID:osamazhar,项目名称:KURAbot,代码行数:14,代码来源:search_table+_beep.py
示例20: __init__
class voice_play:
def __init__(self):
self.voice = rospy.get_param("~voice", "voice_cmu_us_clb_arctic_clunits")
self.sound_files_dir = rospy.get_param("~sound_dir", "")
self.sound_handle = SoundClient()
rospy.sleep(1)
rospy.loginfo("Ready to speak...")
rospy.Subscriber('/speech', String, self.talkback)
rospy.Subscriber('/sounds', String, self.play_sound)
# self.sound_handle.say('Greetings, I am Judith.', self.voice)
def talkback(self, msg):
rospy.loginfo(msg.data)
self.sound_handle.stopAll()
self.sound_handle.say(msg.data, self.voice)
rospy.sleep(2)
def play_sound(self, msg):
rospy.loginfo(msg.data)
self.sound_handle.stopAll()
self.sound_handle.playWave(self.sound_files_dir + msg.data)
rospy.sleep(2)
开发者ID:OpenFEI,项目名称:rfh_judite,代码行数:26,代码来源:voice_play.py
注:本文中的sound_play.libsoundplay.SoundClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论