简体   繁体   English

在Pepper机械手上录制声音时出错

[英]Error when recording sound on Pepper robot

I want my Pepper robot to record a piece of audio using startMicrophonesRecording() . 我希望我的Pepper机器人使用startMicrophonesRecording()录制一段音频。 In NAOqi v2.5 it takes four arguments (path, type, hertz and microphones). NAOqi v2.5中,它需要四个参数(路径,类型,赫兹和麦克风)。 Trying to run 尝试跑步

AD.startMicrophonesRecording("/data/home/nao/recordings/microphones/test.wav","wav",16000,(0,0,1,0))

I however get the error message 但是我收到错误消息

RuntimeError: Arguments types did not match for startMicrophonesRecording (resolved to '(ssi(iiii))'): 
Candidate: 
  startMicrophonesRecording::(s) (1)

It seems that startMicrophonesRecording() only wants one argument. 似乎startMicrophonesRecording()只需要一个参数。 I can see in past versions of the function that it used to only take the file path as an argument, so maybe Python is looking at a past version of NAOqi for the modules? 我可以在该函数的过去版本中看到它过去仅以文件路径作为参数,所以也许Python正在为模块寻找NAOqi的过去版本?

I have tried setting PYTHONPATH to C:\\Users\\<user>\\<path>\\pynaoqi-python2.7-2.5.5.5-win32-vs2013\\lib using this tutorial , but I still get the same error. 我已经尝试使用本教程PYTHONPATH设置为C:\\Users\\<user>\\<path>\\pynaoqi-python2.7-2.5.5.5-win32-vs2013\\lib ,但是仍然出现相同的错误。

Any ideas as to what I can do? 关于我能做什么的任何想法?

Python 2.7 on Windows 10. Windows 10上的Python 2.7

Did you try with one argument? 您是否尝试过一种说法?

The NAOqi v2.5 Link you named, refers to ALAudioRecorder and C++. 您命名的NAOqi v2.5链接是指ALAudioRecorder和C ++。 The "old Version" refers to Python ALAudioDevice . “旧版本”是指Python ALAudioDevice An NAOqi v2.5 Python API for ALAudioDevice is described here . 本文介绍用于ALAudioDevice的NAOqi v2.5 Python API。

For me these python snippets works fine: 对我来说,这些python代码段可以正常工作:

ALAudioDevice : ALAudioDevice

import naoqi
from naoqi import ALProxy
AD = ALProxy("ALAudioDevice", "pepper.local", 9559)
AD.startMicrophonesRecording("/data/home/nao/recordings/microphones/test.wav")
AD.stopMicrophonesRecording()

ALAudioRecorder : ALAudioRecorder

import naoqi
from naoqi import ALProxy
AR = ALProxy("ALAudioRecorder", "pepper.local", 9559)
AR.startMicrophonesRecording("/data/home/nao/recordings/microphones/test.wav","wav",16000,[0,0,1,0])
AR.stopMicrophonesRecording()

Your syntax for selecting microphones looks wrong. 您选择麦克风的语法看起来有误。 Use brackets [] instead of parentheses (): 使用方括号[]代替括号():

    rec = self.session().service("ALAudioRecorder")
    rec.startMicrophonesRecording(fname, 'wav', 16000, [0,0,1,0])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM