• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tones.beep函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tones.beep函数的典型用法代码示例。如果您正苦于以下问题:Python beep函数的具体用法?Python beep怎么用?Python beep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了beep函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: playAudioCoordinates

def playAudioCoordinates(x, y, screenWidth, screenHeight, screenMinPos, detectBrightness=True,blurFactor=0):
	""" play audio coordinates:
	- left to right adjusting the volume between left and right speakers
	- top to bottom adjusts the pitch of the sound
	- brightness adjusts the volume of the sound
	Coordinates (x, y) are absolute, and can be negative.
	"""

	# make relative to (0,0) and positive
	x = x - screenMinPos.x
	y = y - screenMinPos.y

	minPitch=config.conf['mouse']['audioCoordinates_minPitch']
	maxPitch=config.conf['mouse']['audioCoordinates_maxPitch']
	curPitch=minPitch+((maxPitch-minPitch)*((screenHeight-y)/float(screenHeight)))
	if detectBrightness:
		startX=min(max(x-blurFactor,0),screenWidth)+screenMinPos.x
		startY=min(max(y-blurFactor,0),screenHeight)+screenMinPos.y
		width=min(blurFactor+1,screenWidth)
		height=min(blurFactor+1,screenHeight)
		grey=screenBitmap.rgbPixelBrightness(scrBmpObj.captureImage( startX, startY, width, height)[0][0])
		brightness=grey/255.0
		minBrightness=config.conf['mouse']['audioCoordinates_minVolume']
		maxBrightness=config.conf['mouse']['audioCoordinates_maxVolume']
		brightness=(brightness*(maxBrightness-minBrightness))+minBrightness
	else:
		brightness=config.conf['mouse']['audioCoordinates_maxVolume']
	leftVolume=int((85*((screenWidth-float(x))/screenWidth))*brightness)
	rightVolume=int((85*(float(x)/screenWidth))*brightness)
	tones.beep(curPitch,40,left=leftVolume,right=rightVolume)
开发者ID:bramd,项目名称:nvda,代码行数:30,代码来源:mouseHandler.py


示例2: event_valueChange

	def event_valueChange(self):
		pbConf=config.conf["presentation"]["progressBarUpdates"]
		states=self.states
		if pbConf["progressBarOutputMode"]=="off" or controlTypes.STATE_INVISIBLE in states or controlTypes.STATE_OFFSCREEN in states:
			return super(ProgressBar,self).event_valueChange()
		val=self.value
		try:
			percentage = min(max(0.0, float(val.strip("%\0"))), 100.0)
		except (AttributeError, ValueError):
			log.debugWarning("Invalid value: %r" % val)
			return super(ProgressBar, self).event_valueChange()
		braille.handler.handleUpdate(self)
		if not pbConf["reportBackgroundProgressBars"] and not self.isInForeground:
			return
		try:
			left,top,width,height=self.location
		except:
			left=top=width=height=0
		x=left+(width/2)
		y=top+(height/2)
		lastBeepProgressValue=self.progressValueCache.get("beep,%d,%d"%(x,y),None)
		if pbConf["progressBarOutputMode"] in ("beep","both") and (lastBeepProgressValue is None or abs(percentage-lastBeepProgressValue)>=pbConf["beepPercentageInterval"]):
			tones.beep(pbConf["beepMinHZ"]*2**(percentage/25.0),40)
			self.progressValueCache["beep,%d,%d"%(x,y)]=percentage
		lastSpeechProgressValue=self.progressValueCache.get("speech,%d,%d"%(x,y),None)
		if pbConf["progressBarOutputMode"] in ("speak","both") and (lastSpeechProgressValue is None or abs(percentage-lastSpeechProgressValue)>=pbConf["speechPercentageInterval"]):
			queueHandler.queueFunction(queueHandler.eventQueue,speech.speakMessage,_("%d percent")%percentage)
			self.progressValueCache["speech,%d,%d"%(x,y)]=percentage
开发者ID:BobbyWidhalm,项目名称:nvda,代码行数:28,代码来源:behaviors.py


示例3: find

	def find(self, text):
		"""Find a window with the supplied text in its title.
		If the text isn't found in any title, search the text of consoles."""
		consoles = set()
		text = text.lower()
		for c in api.getDesktopObject().children:
			name = c.name
			if name is None:
				continue
			if text in name.lower():
				focus(c.windowHandle)
				return
			elif c.windowClassName == u'ConsoleWindowClass':
				consoles.add(c)

		#We didn't find the search text in the title, start searching consoles
		current_console = winConsoleHandler.consoleObject
		# If our current console is the one with the text in it, presumably we want another one, and if one isn't found, we'll refocus anyway
		if current_console is not None:
			consoles.remove(current_console)
		for console in consoles:
			#We assume this can't fail
			console_text = get_console_text(console)
			if text in console_text.lower():
				focus(console.windowHandle)
				return
		else: #No consoles found
			if current_console:
				winConsoleHandler.connectConsole(current_console)
				if current_console == api.getFocusObject():
					current_console.startMonitoring() #Keep echoing if we didn't switch
		tones.beep(300, 150)
开发者ID:ctoth,项目名称:jumpToWindow,代码行数:32,代码来源:jumpToWindow.py


示例4: done

	def done(self):
		self.timer.Stop()
		pbConf = config.conf["presentation"]["progressBarUpdates"]
		if pbConf["progressBarOutputMode"] in ("beep", "both") and (pbConf["reportBackgroundProgressBars"] or self.IsActive()):
			tones.beep(1760, 40)
		self.Hide()
		self.Destroy()
开发者ID:ehollig,项目名称:nvda,代码行数:7,代码来源:__init__.py


示例5: _speakSpellingGen

def _speakSpellingGen(text,locale,useCharacterDescriptions):
	textLength=len(text)
	synth=getSynth()
	synthConfig=config.conf["speech"][synth.name]
	for count,char in enumerate(text): 
		uppercase=char.isupper()
		charDesc=None
		if useCharacterDescriptions:
			from characterProcessing import getCharacterDescription
			charDesc=getCharacterDescription(locale,char.lower())
		if charDesc:
			char=charDesc
		else:
			char=processSymbol(char)
		if uppercase and synthConfig["sayCapForCapitals"]:
			char=_("cap %s")%char
		if uppercase and synth.isSupported("pitch") and synthConfig["raisePitchForCapitals"]:
			oldPitch=synthConfig["pitch"]
			synth.pitch=max(0,min(oldPitch+synthConfig["capPitchChange"],100))
		index=count+1
		log.io("Speaking character %r"%char)
		if len(char) == 1 and synthConfig["useSpellingFunctionality"]:
			synth.speakCharacter(char,index=index)
		else:
			synth.speakText(char,index=index)
		if uppercase and synth.isSupported("pitch") and synthConfig["raisePitchForCapitals"]:
			synth.pitch=oldPitch
		while textLength>1 and (isPaused or getLastSpeechIndex()!=index):
			yield
			yield
		if uppercase and  synthConfig["beepForCapitals"]:
			tones.beep(2000,50)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:32,代码来源:speech.py


示例6: script_clockLayerCommands

	def script_clockLayerCommands(self, gesture):
		if self.clockLayerModeActive:
			self.script_error(gesture)
			return
		self.bindGestures(self.__clockLayerGestures)
		self.clockLayerModeActive=True
		tones.beep(100, 10)
开发者ID:Oliver2213,项目名称:clock,代码行数:7,代码来源:__init__.py


示例7: speakSpelling

def speakSpelling(text,locale=None,useCharacterDescriptions=False):
	global beenCanceled, _speakSpellingGenID
	import speechViewer
	if speechViewer.isActive:
		speechViewer.appendText(text)
	if speechMode==speechMode_off:
		return
	elif speechMode==speechMode_beeps:
		tones.beep(config.conf["speech"]["beepSpeechModePitch"],speechMode_beeps_ms)
		return
	if isPaused:
		cancelSpeech()
	beenCanceled=False
	from languageHandler import getLanguage
	locale=getLanguage()
	if not isinstance(text,basestring) or len(text)==0:
		return getSynth().speakText(processSymbol(""))
	if not text.isspace():
		text=text.rstrip()
	gen=_speakSpellingGen(text,locale,useCharacterDescriptions)
	try:
		# Speak the first character before this function returns.
		next(gen)
	except StopIteration:
		return
	_speakSpellingGenID=queueHandler.registerGeneratorObject(gen)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:26,代码来源:speech.py


示例8: event_typedCharacter

	def event_typedCharacter(self, ch):
		super(EditWindow, self).event_typedCharacter(ch)
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		textInfo = self.makeTextInfo(textInfos.POSITION_CARET)
		textInfo.expand(textInfos.UNIT_LINE)
		if textInfo.bookmark.endOffset - textInfo.bookmark.startOffset >= config.conf["notepadPp"]["maxLineLength"]:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:8,代码来源:editWindow.py


示例9: script_reportLineOverflow

	def script_reportLineOverflow(self, gesture):
		if self.appModule.isAutocomplete:
			gesture.send()
			return
		self.script_caret_moveByLine(gesture)
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		info = self.makeTextInfo(textInfos.POSITION_CARET)
		info.expand(textInfos.UNIT_LINE)
		if len(info.text.strip('\r\n\t ')) > config.conf["notepadPp"]["maxLineLength"]:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:11,代码来源:editWindow.py


示例10: speakingHook

def speakingHook(d):
	percentage=0
	frequency=100
	if d['status'] == 'downloading':
		percentage=int((float(d['downloaded_bytes'])/d['total_bytes'])*100)
		frequency=100+percentage
		tones.beep(frequency, 50)
	elif d['status'] == 'finished':
		ui.message(_("Download complete. Converting video."))
	elif d['status'] == 'error':
		ui.message(_("Download error."))
开发者ID:Oliver2213,项目名称:NVDAYoutube-dl,代码行数:11,代码来源:__init__.py


示例11: event_UIA_notification

	def event_UIA_notification(self, obj, nextHandler, notificationKind=None, notificationProcessing=None, displayString=None, activityId=None):
		# Introduced in Version 1709, to be treated as a notification event.
		self.uiaDebugLogging(obj, "notification")
		if isinstance(obj, UIA) and globalVars.appArgs.debugLogging:
			log.debug("W10: UIA notification: sender: %s, notification kind: %s, notification processing: %s, display string: %s, activity ID: %s"%(obj.UIAElement,notificationKind,notificationProcessing,displayString,activityId))
			# Play a debug tone if and only if notifications come from somewhere other than the active app.
			if obj.appModule != api.getFocusObject().appModule:
				import tones
				# For debugging purposes.
				tones.beep(500, 100)
		nextHandler()
开发者ID:josephsl,项目名称:wintenApps,代码行数:11,代码来源:__init__.py


示例12: event_typedCharacter

    def event_typedCharacter(self, ch):
        speech.speakTypedCharacters(ch)
        import winUser

        if (
            config.conf["keyboard"]["beepForLowercaseWithCapslock"]
            and ch.islower()
            and winUser.getKeyState(winUser.VK_CAPITAL) & 1
        ):
            import tones

            tones.beep(3000, 40)
开发者ID:rbmendoza,项目名称:nvda,代码行数:12,代码来源:__init__.py


示例13: event_caret

	def event_caret(self):
		super(EditWindow, self).event_caret()
		if not config.conf["notepadPp"]["lineLengthIndicator"]:
			return
		caretInfo = self.makeTextInfo(textInfos.POSITION_CARET)
		lineStartInfo = self.makeTextInfo(textInfos.POSITION_CARET).copy()
		caretInfo.expand(textInfos.UNIT_CHARACTER)
		lineStartInfo.expand(textInfos.UNIT_LINE)
		caretPosition = caretInfo.bookmark.startOffset -lineStartInfo.bookmark.startOffset
		#Is it not a blank line, and are we further in the line than the marker position?
		if caretPosition > config.conf["notepadPp"]["maxLineLength"] -1 and caretInfo.text not in ['\r', '\n']:
			tones.beep(500, 50)
开发者ID:derekriemer,项目名称:nvda-notepadPlusPlus,代码行数:12,代码来源:editWindow.py


示例14: event_typedCharacter

	def event_typedCharacter(self,ch):
		if config.conf["documentFormatting"]["reportSpellingErrors"] and config.conf["keyboard"]["alertForSpellingErrors"] and (
			# Not alpha, apostrophe or control.
			ch.isspace() or (ch >= u" " and ch not in u"'\x7f" and not ch.isalpha())
		):
			# Reporting of spelling errors is enabled and this character ends a word.
			self._reportErrorInPreviousWord()
		speech.speakTypedCharacters(ch)
		import winUser
		if config.conf["keyboard"]["beepForLowercaseWithCapslock"] and ch.islower() and winUser.getKeyState(winUser.VK_CAPITAL)&1:
			import tones
			tones.beep(3000,40)
开发者ID:jhomme,项目名称:nvda,代码行数:12,代码来源:__init__.py


示例15: beep_sequence

def beep_sequence(*sequence):
	"""	Play a simple synchronous monophonic beep sequence
	A beep sequence is an iterable containing one of two kinds of elements.
	An element consisting of a tuple of two items is interpreted as a frequency and duration. Note, this function plays beeps synchronously, unlike tones.beep
	A single integer is assumed to be a delay in ms.
	"""
	for element in sequence:
		if not isinstance(element, collections.Sequence):
			time.sleep(element / 1000)
		else:
			tone, duration = element
			time.sleep(duration / 1000)
			tones.beep(tone, duration)
开发者ID:cafeventos,项目名称:NVDARemote,代码行数:13,代码来源:beep_sequence.py


示例16: resumeTouchInteraction

	def resumeTouchInteraction(self, profileSwitch=False):
		if not touchHandler.handler:
			try:
				self.etsDebugOutput("etouch: attempting to enable touch handler")
				touchHandler.initialize()
				if not profileSwitch:
					ui.message("Touch passthrough off")
					import tones
					tones.beep(380, 100)
			except:
				if not profileSwitch: ui.message("Touch is not supported")
			finally:
				self.touchPassthroughTimer = None
开发者ID:josephsl,项目名称:enhancedTouchGestures,代码行数:13,代码来源:__init__.py


示例17: event_becomeNavigatorObject

	def event_becomeNavigatorObject(self):
		l,t,w,h=self.location
		x = l+(w/2)
		y = t+(h/2)
		screenWidth, screenHeight = api.getDesktopObject().location[2:]
		if x <= screenWidth or y <= screenHeight:
			minPitch=config.conf['mouse']['audioCoordinates_minPitch']
			maxPitch=config.conf['mouse']['audioCoordinates_maxPitch']
			curPitch=minPitch+((maxPitch-minPitch)*((screenHeight-y)/float(screenHeight)))
			brightness=config.conf['mouse']['audioCoordinates_maxVolume']
			leftVolume=int((85*((screenWidth-float(x))/screenWidth))*brightness)
			rightVolume=int((85*(float(x)/screenWidth))*brightness)
			tones.beep(curPitch,40,left=leftVolume,right=rightVolume)
		super(MapLocation,self).event_becomeNavigatorObject()
开发者ID:josephsl,项目名称:wintenApps,代码行数:14,代码来源:maps.py


示例18: Pulse

	def Pulse(self):
		super(IndeterminateProgressDialog, self).Pulse()
		# We want progress to be spoken on the first pulse and every 10 pulses thereafter.
		# Therefore, cycle from 0 to 9 inclusive.
		self._speechCounter = (self._speechCounter + 1) % 10
		pbConf = config.conf["presentation"]["progressBarUpdates"]
		if pbConf["progressBarOutputMode"] == "off":
			return
		if not pbConf["reportBackgroundProgressBars"] and not self.IsActive():
			return
		if pbConf["progressBarOutputMode"] in ("beep", "both"):
			tones.beep(440, 40)
		if pbConf["progressBarOutputMode"] in ("speak", "both") and self._speechCounter == 0:
			# Translators: Announced periodically to indicate progress for an indeterminate progress bar.
			speech.speakMessage(_("Please wait"))
开发者ID:timothytylee,项目名称:nvda,代码行数:15,代码来源:__init__.py


示例19: _reportIndentChange

	def _reportIndentChange(self, text):
		""" Reports the current level change as a tone. The first twenty levels are given distinct stereo positions, and otherwise, no tone will play.
		@var text: The text to report indents for. Only pass a homoginous set of tabs or spaces, because the length is calculated assuming each character is one indent unit.
		@type text: string
		@returns: Indent level.
		"""
		level = len(text) #assume 1 indent unit per character.
		if level > MAX_LEVEL:
			return level
		volume = speech.getSynth().volume
		note = 128*2**(level/MAX_LEVEL*3) #MAX_LEVEL*3 gives us 3 octaves of whole tones.
		#calculate stereo values. NVDA expects  values between 0 and 100 for stereo volume for each channel.
		right = int((volume/(MAX_LEVEL-1))*level)
		left = volume-right
		tones.beep(note, 80, left=left, right=right)
		return level
开发者ID:derekriemer,项目名称:nvda-indentone,代码行数:16,代码来源:indentone.py


示例20: script_toggleTouchPassthrough

	def script_toggleTouchPassthrough(self, gesture):
		# First, check if timer is running, and if so, enable touch interaction (manual toggle).
		if ((not touchHandler.handler and config.conf["touch"]["manualPassthroughToggle"])
		or (self.touchPassthroughTimer and self.touchPassthroughTimer.IsRunning())):
			self.etsDebugOutput("etouch: manually enabling touch handler")
			self.resumeTouchInteraction()
			return
		if touchHandler.handler:
			self.etsDebugOutput("etouch: disabling touch handler")
			touchHandler.terminate()
			ui.message("Touch passthrough on")
			import tones
			tones.beep(760, 100)
			if not config.conf["touch"]["manualPassthroughToggle"]:
				self.touchPassthroughTimer = wx.PyTimer(self.resumeTouchInteraction)
				self.touchPassthroughTimer.Start(config.conf["touch"]["commandPassthroughDuration"]*1000, True)
开发者ID:josephsl,项目名称:enhancedTouchGestures,代码行数:16,代码来源:__init__.py



注:本文中的tones.beep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_db_util.get_installed_repository_by_name_owner函数代码示例发布时间:2022-05-27
下一篇:
Python utils.set_array函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap