本文整理汇总了Python中naoqi.ALProxy.setOutputVolume方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.setOutputVolume方法的具体用法?Python ALProxy.setOutputVolume怎么用?Python ALProxy.setOutputVolume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naoqi.ALProxy
的用法示例。
在下文中一共展示了ALProxy.setOutputVolume方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
class Status:
def __init__(self):
self.mem = ALProxy("ALMemory", "nao.local", 9559)
self.batteryListData = [
"Device/SubDeviceList/Battery/Current/Sensor/Value",
"Device/SubDeviceList/Battery/Charge/Sensor/Status",
"Device/SubDeviceList/Battery/Charge/Sensor/Value",]
self.temperatureListData = [
"Device/SubDeviceList/Head/Temperature/Sensor/Value", #0: CPU temperature
]
self.audioPlayerProxy = ALProxy("ALAudioPlayer" , "nao.local", 9559)
self.audioDeviceProxy = ALProxy("ALAudioDevice" , "nao.local", 9559)
def getBatteryStatus(self):
return self.mem.getListData(self.batteryListData)[2]*100
def getCPUTemperature(self):
return self.mem.getListData(self.temperatureListData)[0]
def getSpeakerVolume(self):
print self.audioDeviceProxy.getOutputVolume()
return self.audioDeviceProxy.getOutputVolume()
def setSpeakerVolume(self, value):
self.audioDeviceProxy.setOutputVolume(value)
fileId = self.audioPlayerProxy.loadFile("/usr/share/naoqi/wav/random.wav")
time.sleep(5)
self.audioPlayerProxy.play(fileId)
def printAllSensors(self):
for key in self.mem.getDataListName():
print key
示例2: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def main():
parser = OptionParser(usage="Usage: %prog [options] [phrase1 [phrase2 ...]]")
parser.add_option("-v", "--volume",
action="store", type="int", dest="volume",
help=u"définir le volume", metavar="VOL")
(options, args) = parser.parse_args()
if (options.volume):
vol = ALProxy("ALAudioDevice", IP, PORT)
vol.setOutputVolume(min(max(options.volume, 0), 100))
tts = ALProxy("ALTextToSpeech", IP, PORT)
tts.setLanguage('French')
if len(args) == 0:
line = 1
while line:
try:
line = stdin.readline().strip('\n')
except KeyboardInterrupt:
break
if line:
say(tts, line)
else:
for arg in args:
say(tts, arg)
示例3: exe
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def exe(self, args=None, addr=None):
# get proxies
audio = ALProxy("ALAudioDevice", Settings.naoHostName, Settings.naoPort)
# set system volume
if len(args) > 0:
audio.setOutputVolume( int(args[0]) )
示例4: setVol
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def setVol( vol ):
player = ALProxy( "ALAudioDevice", config.naoIP, config.naoPort )
print "master volume set to " + str(vol) + "%"
try: player.setOutputVolume( vol )
except: return False
return True
示例5: set_volume
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def set_volume(volume):
logger.debug("set_volume() called")
vol = int(volume)
if ((vol <= 100) and (vol >= 0)):
audioDeviceProxy = ALProxy("ALAudioDevice", nao_host, nao_port)
audioDeviceProxy.setOutputVolume(vol)
return jsonify({"volume": vol}), 200
else:
return jsonify({"error": "Volume out of range [0,100]"}), 400
示例6: __init__
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def __init__(self, ip, port, _myBroker):
self.NAOip = ip
self.NAOport = port
#========SETUP FOR MOTION=============
ALModule.__init__(self, "BasicMotions")
self.myBroker=_myBroker
bModulePresent = self.myBroker.isModulePresent("BasicMotions")
print("BasicMotions module status:", bModulePresent)
global memory
memory = ALProxy("ALMemory")
self.SubscribeAllTouchEvent()
self.createEyeGroup()
self.eyeColor={'happy': 0x0000FF00,
'sad': 0x00600088,
'scared1': 0x00000060,
'scared2': 0x00000060,
'fear': 0x00000060,
'hope': 0x00FFB428,
'anger': 0x00FF0000}
self.eyeShape={'happy': "EyeTop",
'sad': "EyeBottom",
'scared1': "EyeNone",
'scared2': "EyeNone",
'fear': "EyeBottom",
'hope': "EyeTop",
'anger': "EyeTopBottom"}
self.bScared = False
#=========SETUP FOR VOICE================
self.tts = ALProxy("ALTextToSpeech")
audioProxy = ALProxy("ALAudioDevice")
audioProxy.setOutputVolume(100)
#Valid Value:50 to 200
self.ttsPitch={ 'default': "\\vct=100\\",
'happy': "\\vct=120\\",
'sad': "\\vct=50\\",
'scared': "\\vct=150\\",
'fear': "\\vct=60\\",
'hope': "\\vct=100\\",
'anger': "\\vct=60\\"}
#Valid Value: 50 to 400"\\
self.ttsSpeed={ 'default': "\\rspd=100\\",
'happy': "\\rspd=100\\",
'sad': "\\rspd=70\\",
'scared': "\\rspd=130\\",
'fear': "\\rspd=100\\",
'hope': "\\rspd=100\\",
'anger': "\\rspd=110\\"}
#Valid Value: 0 to 100
self.ttsVolume={ 'default': "\\vol=050\\",
'happy': "\\vol=060\\",
'sad': "\\vol=035\\",
'scared': "\\vol=060\\",
'fear': "\\vol=050\\",
'hope': "\\vol=050\\",
'anger': "\\vol=060\\"}
#=================================================
self.createDialog()
示例7: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def main(robotIP, PORT=9559):
# tts = ALProxy("ALTextToSpeech", robotIP, PORT)
# tts.post.say("前进,,前进.")
audiodevice = ALProxy("ALAudioDevice", robotIP, PORT)
currentVoice = audiodevice.getOutputVolume()
audiodevice.setOutputVolume(currentVoice + 10)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
postureProxy.goToPosture("StandInit", 0.5)
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
motionProxy.setMoveArmsEnabled(True, True)
motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION", True]])
motionProxy.post.moveTo(0.8, 0, 0)
motionProxy.waitUntilMoveIsFinished()
print "Robot Move forward"
示例8: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
def main(robotIP, PORT=9559):
# tts = ALProxy("ALTextToSpeech", robotIP, PORT)
# tts.post.say("我这就退后0.6米.")
# lower the volume by 10%
audioDevice = ALProxy("ALAudioDevice", robotIP, PORT)
currentVoice = audioDevice.getOutputVolume()
audioDevice.setOutputVolume(currentVoice - 10)
# stand first
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
postureProxy.goToPosture("StandInit", 0.5)
motionProxy = ALProxy("ALMotion", robotIP, PORT)
motionProxy.wakeUp()
motionProxy.setMoveArmsEnabled(True, True)
motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION", True]])
# action move
motionProxy.post.moveTo(-0.618, 0, 0)
motionProxy.waitUntilMoveIsFinished()
print "Robot Move: back"
示例9: ALProxy
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
from naoqi import ALProxy
import time
import os
import sys
# Built ins loaded
speak = ALProxy("ALTextToSpeech", "127.0.0.1", 9559)
audio = ALProxy('ALAudioDevice', '127.0.0.1', 9559)
memory = ALProxy("ALMemory", "127.0.0.1", 9559)
sentinel = ALProxy("ALSentinel", "127.0.0.1", 9559)
audio = ALProxy('ALAudioDevice', '127.0.0.1', 9559)
# Enable Button actions and Sound.
sentinel.enableDefaultActionSimpleClick(True)
sentinel.enableDefaultActionDoubleClick(True)
audio.setOutputVolume(90)
football = False
# Check if commandline arguments are given
if ( ( len( sys.argv ) > 1 ) and ( sys.argv[1] == "True" ) ):
football = True
else:
speak.say("Press my bumper to awake my football soul")
start = time.time()
while time.time() - start < 2:
if (not((memory.getData("LeftBumperPressed", 0) == 0.0)) or not((memory.getData("RightBumperPressed", 0) == 0.0))):
football = True
# Load football code if pressed
if football:
speak.say("Awaking football soul")
示例10: ALProxy
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
from naoqi import ALProxy
NAOIP = "leia.local"
NAOPort = 9559
tts = ALProxy("ALTextToSpeech", NAOIP, NAOPort)
audioProxy = ALProxy("ALAudioDevice", NAOIP, NAOPort)
audioProxy.setOutputVolume(100/2)
t = "Hello, I am speaking in some kind of voice right now."
fear = ""
fear += "\\rspd=100\\"
fear += "\\vol=050\\"
fear += "\\vct=60\\"
tts.setParameter("pitchShift", 0)
tts.say(fear + t)
tts.setParameter("doubleVoice", 1)
tts.setParameter("doubleVoiceLevel", 1)
tts.setParameter("doubleVoiceTimeShift", 0.1)
tts.setParameter("pitchShift", 1.1)
tts.say(fear + t)
示例11: ALProxy
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
# warming up the camera!
# seriously, this is necessary
vidProxy = ALProxy("ALVideoDevice", "127.0.0.1", 9559)
vidProxy.setParam(18, 1)
del vidProxy
# Proxies
ttsProxy = ALProxy("ALTextToSpeech", "127.0.0.1", 9559)
audProxy = ALProxy('ALAudioDevice', '127.0.0.1', 9559)
memProxy = ALProxy("ALMemory", "127.0.0.1", 9559)
senProxy = ALProxy("ALSentinel", "127.0.0.1", 9559)
# Enable Button actions and Sound.
senProxy.enableDefaultActionSimpleClick(True)
senProxy.enableDefaultActionDoubleClick(True)
audProxy.setOutputVolume(200)
# Soul variable
soul = False
ttsProxy.say("Press button for Pleasure Mode")
start = time.time()
while time.time() - start < 2.7:
if (((memProxy.getData("LeftBumperPressed", 0) != 0.0) or \
(memProxy.getData("RightBumperPressed", 0) != 0.0)) or \
((len(sys.argv) > 1 ) and (sys.argv[1] == "True"))):
soul = True
break
# Activate soul
示例12: TalkingBot
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import setOutputVolume [as 别名]
#.........这里部分代码省略.........
#reactToTouch.setThread(self)
self.decision = None
self.robotIP = robotIP
self.PORT = PORT
self.participantName = participantName
self.volume = volume
self.tts = ALProxy("ALAnimatedSpeech", robotIP, PORT)
self.motion = ALProxy("ALMotion", robotIP, PORT)
self.posture = ALProxy("ALRobotPosture", robotIP, PORT)
self.vol = ALProxy("ALAudioDevice", robotIP, PORT)
self.video = ALProxy("ALVideoDevice", robotIP, PORT)
self.autonomousMoves = ALProxy("ALAutonomousMoves", robotIP, PORT)
self.compass = ALProxy("ALVisualCompass", robotIP, PORT)
self.markProxy = ALProxy("ALLandMarkDetection", robotIP, PORT)
self.memProxy = ALProxy("ALMemory", robotIP, PORT)
self.behave = ALProxy("ALBehaviorManager", robotIP, PORT)
self.markProxy.subscribe("Test_LandMark", 500, 0.0 )
#json_data=open('randomSeceneDataSet.json')
#data = json.load(json_data)
self.data = cjson.parse_json('randomSeceneDataSet.json')
self.motion.setExternalCollisionProtectionEnabled("All", False)
self.motion.setOrthogonalSecurityDistance(0.0)
self.motion.setTangentialSecurityDistance(0.0)
self.autonomousMoves.setExpressiveListeningEnabled(False)
#print(data)
#ReactToTouch.setThread(self)
self.wakeRobotUp()
self.vol.setOutputVolume(volume)
#self.goToPerson(str(participantName))
self.walkTo(int(user_id), True)
##############################
# Activity should be later. This is just for now
self.data["activity"]
self.maxActivies = []
for a in self.data["activity"]:
t = {
"name":a["name"],
"animation":a["animation"],
"file":a["file"],
"time":a["time"],
"text":None
}
if a["animation"] is True:
oneSay= True
if oneSay is True:
b = random.choice (a["namings"])
if t["time"] < b["time"]:
t["time"] = b["time"]