我想用Pepper机器人在有限的时间内听到的声音创建一个文件。总而言之,我如何创建一个包含Pepper听音的.wav文件?实际上,我使用ALAudioRecorder NaoQi库,但遇到以下有关序列化返回值的错误。
import com.aldebaran.qi.Application;
import com.aldebaran.qi.helper.proxies.ALAudioRecorder;
public class helloWord {
public static void main(String[] args) throws Exception {
String robotUrl = "tcp://pepper.local:9559";/*pepper.local.:9559*/
Application application = new Application(args, robotUrl);
application.start();
boolean[] array = {false,false,true,false};
ALAudioRecorder alAudioRecorder=new ALAudioRecorder(application.session());
alAudioRecorder.startMicrophonesRecording("D:/test/test.wav", "wav",48000,array);}}
Exception in thread "main" java.lang.RuntimeException: Cannot serialize return value: Unable to convert JObject in AnyValue
at com.aldebaran.qi.Future.get(Future.java:96)
at com.aldebaran.qi.helper.proxies.ALAudioRecorder.startMicrophonesRecording(ALAudioRecorder.java:185)
at helloWord.main(helloWord.java:26)
最佳答案
正如Alexandre所说,您的问题在这里:
alAudioRecorder.startMicrophonesRecording(“ D:/test/test.wav”,“ wav”,48000,array);}}
由于录音机服务正在机械手上运行,因此它将无法访问D:路径,因此您需要机械手(unix)文件系统上的路径,例如“ /home/nao/test.wav
”。