0

I am trying to implement the ALAutioRecorder API codes from http://doc.aldebaran.com/2-4/naoqi/audio/alaudiorecorder-api.html#alaudiorecorder-api into my application but i am not really sure how to do so.The codes below are the ones i have no idea where to place it as i am pretty new to this application

#include <iostream>
#include <alproxies/alaudiorecorderproxy.h>
#include <qi/os.hpp>

int main(int argc, char **argv)
{
  if (argc < 2) {
    std::cerr << "Usage: alaudiorecorder_startrecording pIp"
              << std::endl;
    return 1;
  }
  const std::string pIp = argv[1];

  AL::ALAudioRecorderProxy proxy(pIp);

  /// Configures the channels that need to be recorded.
  AL::ALValue channels;
  channels.arrayPush(0); //Left
  channels.arrayPush(0); //Right
  channels.arrayPush(1); //Front
  channels.arrayPush(0); //Rear

  /// Starts the recording of NAO's front microphone at 16000Hz
  /// in the specified wav file
  proxy.startMicrophonesRecording("/home/nao/test.wav", "wav", 16000, channels);

  qi::os::sleep(5);

  /// Stops the recording and close the file after 10 seconds.
  proxy.stopMicrophonesRecording();

  return 0;
}
Thibaut
  • 19
  • 10
  • I'm not a great fan of this module, I've heard people complaining about loss of packets. And also, you cannot analyse chunk on the fly. That's why my advice is to use this kind of modules: https://stackoverflow.com/questions/24243757/nao-robot-remote-audio-problems/24699052#24699052 – Alexandre Mazel Jun 02 '17 at 13:59
  • @AlexandreMazel Thanks, will give it a try – Thibaut Jun 05 '17 at 05:51

1 Answers1

0

If you are doing a behavior inside Choregraphe, there should be a box "Record Sound" inside the box library that probably already does what you need or at least gives you a good start.

G. Vallat
  • 56
  • 3