本文整理汇总了Python中speech.say函数的典型用法代码示例。如果您正苦于以下问题:Python say函数的具体用法?Python say怎么用?Python say使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了say函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: veto
def veto(self, mess, args):
"""Will veto the currently playing track"""
print mess.getFrom().getStripped().lower()
registered = usermanager.get_user_real_name(mess.getFrom().getStripped().lower())
if registered:
vetoed = usermanager.add_veto(mess.getFrom().getStripped().lower())
if vetoed:
pytify.playpause()
speech.say(vetoed)
## self.broadcast("Veto! %s vetoed: %s by %s" % (mess.getFrom().getStripped().lower(), pytify.getCurrentTrack(), pytify.getCurrentArtist()))
pytify.next()
return "Vetoed"
else:
return "You already vetoed a song today!"
else:
return "You are not authorised to use this system"
def reload(self, mess, args):
"""Will reload the currently playing track"""
print mess.getFrom().getStripped().lower()
pytify.playpause()
speech.say("Bound to the reload!")
## self.broadcast("Veto! %s vetoed: %s by %s" % (mess.getFrom().getStripped().lower(), pytify.getCurrentTrack(), pytify.getCurrentArtist()))
pytify.previous()
return "Reloaded"
开发者ID:beluho,项目名称:spotifybot,代码行数:26,代码来源:spotify_bot.py
示例2: say
def say(sentence):
open_eyes()
if use_voice:
speech.say(sentence, speed=120, pitch=100, throat=190, mouth=190)
else:
display.scroll(sentence, delay=75)
close_eyes()
开发者ID:deejaygraham,项目名称:deejaygraham.github.io,代码行数:7,代码来源:mentalism-robot.py
示例3: read_weather
def read_weather():
# Currently, weather will be a dictionary with a comment, temp, and max.
location = settings.get_preference('location')
w = get_weather(location)
say('The weather for %s includes %s' %(location, w['comment']))
say('It is currently %d. Expect it to get %.2f degrees warmer'
%(w['temp'], w['max'] - w['temp']))
开发者ID:stevejarvis,项目名称:morningpi,代码行数:7,代码来源:main.py
示例4: test_funcs
def test_funcs():
print('Testing basic functions')
ph = speech.translate('hello world')
assert ph == ' /HEHLOW WERLD'
speech.pronounce('PIHTHUN', pitch=32, speed=60, mouth=100, throat=150)
speech.say('hello')
speech.sing('YEHSTERDEY5')
开发者ID:carlosperate,项目名称:micropython,代码行数:7,代码来源:test_speech.py
示例5: test_sleep
def test_sleep():
# check that sleep works ok with speech because they both use low-level timers
# (this is really a test of the audio module)
print('Testing sleep with speech')
microbit.sleep(1)
speech.say('hello world')
microbit.sleep(1)
开发者ID:carlosperate,项目名称:micropython,代码行数:7,代码来源:test_speech.py
示例6: execute
def execute(cmd):
cmd,params = [c.strip() for c in cmd.split(':')]
if cmd == 'say':
speech.say(params)
if cmd == 'pwr' and params == 'off':
import win32api
win32api.ExitWindowsEx(24,0)
开发者ID:highfestiva,项目名称:aid-band,代码行数:7,代码来源:aidband.py
示例7: initializeUserData
def initializeUserData():
'''
Should only be used in tests.
Collects user data every time program starts.
In official version this should store data permanently,
not to memory.
'''
wantedName=False #boolean variable which states that the user is OK with his/her name or not
while not wantedName:
speech.say('what is your name?')
name=speech.input() #stores user input to name variable
speech.say('your name is ' + name)
speech.say('is this o k with you')
response=speech.input() #stores user response to previous question to variable
if response=='Yes':
wantedName=True #user is OK with name
gender=None #creates gender variable. we dont know users gender yet (hence the None)
doneGender=False
while not doneGender: #same thing as before
speech.say(name + ', What is your sex, male or female?')
gender=speech.input() #user's response
if gender=='Male' or gender=='Mail': #pyspeech misinterprets 'male' for 'mail' sometimes
pronoun='sir' #this is what CHRIS will use to refer to the user
doneGender=True
if gender=='Female':
pronoun='mam'
doneGender=True
speech.say('O K , we\'re done')
ret_info=[name, gender, pronoun] #returns the name, gender, and pronoun of the user in form of list
return ret_info
开发者ID:ChrisVoiceUser,项目名称:CHRIS-repo,代码行数:31,代码来源:CHRIS.py
示例8: speakScrambledWord
def speakScrambledWord(self):
s = str(self.scrambledLabel.text())
speech.say("Unscramble : ")
for char in s:
speech.say(char + '...')
# speech.say(phrase)
self.lineEdit.setFocus()
开发者ID:hoodakaushal,项目名称:nss-sic-intern,代码行数:7,代码来源:unscramblify.py
示例9: blockListen
def blockListen():
while True:
phrase = speech.input()
speech.say("You said %s" % phrase)
print "You said " + phrase
if phrase == "turn off":
break
开发者ID:Devangin9,项目名称:MirrorTest,代码行数:7,代码来源:Text.py
示例10: pitch_adjusted_cb
def pitch_adjusted_cb(self, get):
speech.pitch = int(get.get_value())
speech.say(_("pitch adjusted"))
f = open(os.path.join(self.activity.get_activity_root(), 'instance', 'pitch.txt'), 'w')
try:
f.write(str(speech.pitch))
finally:
f.close()
开发者ID:leonardcj,项目名称:readetexts,代码行数:8,代码来源:readtoolbar.py
示例11: rate_adjusted_cb
def rate_adjusted_cb(self, get):
speech.rate = int(get.get_value())
speech.say(_("rate adjusted"))
f = open(os.path.join(self.activity.get_activity_root(), 'instance', 'rate.txt'), 'w')
try:
f.write(str(speech.rate))
finally:
f.close()
开发者ID:leonardcj,项目名称:readetexts,代码行数:8,代码来源:readtoolbar.py
示例12: computer
def computer(self, mess, args):
if 'i order you to say' in args.lower():
pytify.playpause()
new_string = args.lower().replace("i order you to say", '')
speech.say(new_string)
pytify.playpause()
else:
return "I didn't understand that command"
开发者ID:beluho,项目名称:spotifybot,代码行数:8,代码来源:spotify_bot.py
示例13: callback
def callback(self, phrase, listener):
if ((phrase == "Stop") or (phrase == "STOP") or (phrase == "stop")):
listener.stoplistening()
if ((phrase == "Next") or (phrase == "NEXT") or (phrase == "next")):
listener.stoplistening()
speech.say(phrase)
开发者ID:suhas-p-bharadwaj,项目名称:Speech-based-web-browser-for-the-Visually-Impaired,代码行数:8,代码来源:SpeechRecogTool1.py
示例14: button_action
def button_action(sender):
global lang
v['switch1'].action = brit_switch_action
text = textview.text
if text == '':
speech.say('Please tell me something to say.', lang, 0.1)
else:
speech.say(text, lang, 0.1)
开发者ID:cclauss,项目名称:Fun-Pythonista-Tools,代码行数:8,代码来源:speech.py
示例15: handle_button_action
def handle_button_action(self, name, sender):
BUTTON_PREFIX = 'button_'
INFO_PREFIX = 'info_'
if name == 'button_start_speech':
speech.say(sample_text.get_sample_text(), 'de', 1.0 * self.conf.rechtschreibung.speech_speed / 100.0)
elif name == 'button_stop_speech':
speech.stop()
elif name == 'button_load_mode':
self.load_mode_start(LOAD_MODE_RULESET)
elif name == 'button_load_reference_mode':
self.load_mode_start(LOAD_MODE_REFERENCE)
elif name == 'button_save_mode':
self.save_mode_start()
elif name == 'button_open_app_control_view':
self.open_app_control_view()
elif name == 'button_open_top_navigation_view':
self.open_top_navigation_view()
elif name == 'button_open_statistics_view':
self.open_statistics_view()
elif name == 'button_close_top_navigation_view':
self.close_top_navigation_view()
elif name == 'button_icon_rechtschreibung':
self.button_icon_rechtschreibung()
elif name.startswith(BUTTON_PREFIX):
view_name = name[len(BUTTON_PREFIX):]
child_view = self.find_subview_by_name(view_name)
if child_view != None:
view = self.find_subview_by_name(NAME_NAVIGATION_VIEW)
view.push_view(child_view)
return 1
else:
logger.warning("cannot find subview '%s" % view_name)
elif name.startswith(INFO_PREFIX):
info_name = name[len(INFO_PREFIX):]
rule_info = self.rule_doc_manager.get_rule_info_by_attr_name(info_name)
if rule_info:
self.info_popup.present(rule_info, close_label=words.schlieszen(c=rulesets.C_BOS))
else:
logger.error("cannot find info text for %s" % info_name)
else:
super(MainViewController, self).handle_button_action(name, sender)
开发者ID:marcus67,项目名称:rechtschreibung,代码行数:57,代码来源:rechtschreibung.py
示例16: test_timing
def test_timing():
# test that speech takes the correct amount of time over many runs
print('Testing timing of say function')
for i in range(5):
start = microbit.running_time()
speech.say('hello world')
microbit.sleep(1)
stop = microbit.running_time()
assert 800 < stop - start < 815
开发者ID:carlosperate,项目名称:micropython,代码行数:9,代码来源:test_speech.py
示例17: before_present
def before_present(self):
word = self.recite.pickone()
if word is None:
self.close()
else:
self[LABEL_WORD_NAME].text = word.word
self[LABEL_TOTAL_NUM_NAME].text = str(self.recite.reciting_length())
if self.auto_speech:
speech.say(word.word, 'en-US')
开发者ID:njuaplusplus,项目名称:pythonista-gre,代码行数:9,代码来源:Test.py
示例18: speaknowButtonTapped
def speaknowButtonTapped(self, sender):
assert sender.name == 'speakTimeButton', 'Invalid button name: ' + sender.name
# Get the say seconds preference
isSaySeconds = sender.superview['speakSecondsSwitch'].value
if traceFlag: print 'isSaySeconds current value now->>' + str(isSaySeconds)
timeMessage = self.getCurrentLocalTimeAnnouncement(isSaySeconds)
if traceFlag: print 'Time message to announce ->>' + timeMessage
speech.say(timeMessage,locale, speechDelay)
开发者ID:ltddev,项目名称:MyPythonista,代码行数:9,代码来源:PythonistaClockWidget.py
示例19: readFeeds
def readFeeds():
url = "http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss"
rootfeed = feedparser.parse(url)
speech.say("Today's top headlines")
titles = []
for entry in rootfeed["entries"]:
titles.append(entry.title)
print (entry.title)
return titles
#speech.say("That's all of today's top headlines")
开发者ID:alfiyansys,项目名称:JAISS,代码行数:11,代码来源:speakWebPage.py
示例20: __init__
def __init__(self, parent=None):
super(HighscoresDialog, self).__init__(parent)
self.setupUi(self)
self.readScores()
i = 1
for item in self.scores:
self.listWidget.addItem(QString('%i. %s. Score : %i' % (i, item, self.scores[item][1])))
i += 1
self.listWidget.setCurrentItem(self.listWidget.item(0))
speech.say(str(self.listWidget.currentItem().text()) + '.')
self.listWidget.currentRowChanged.connect(self.speakItem)
开发者ID:hoodakaushal,项目名称:nss-sic-intern,代码行数:11,代码来源:unscramblify.py
注:本文中的speech.say函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论