Aldebaran documentation What's new in NAOqi 2.4.3?

ALAudioRecorder API

NAOqi Audio - Overview | API

Namespace : AL

#include <alproxies/alaudiorecorderproxy.h>

Method list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class ALAudioRecorderProxy


void ALAudioRecorderProxy::startMicrophonesRecording(const std::string& filename, const std::string& type, const int& samplerate, const AL::ALValue& channels)

This method launches the recording of the audio signal measured by the microphones formated as specified. The resulting recording is written in the specified file.

Note that these recording capabilities are currently limited to the following formats:

  • four channels 48000Hz in OGG.
  • four channels 48000Hz in WAV uncompressed.
  • one channels (front, rear, left or right), 16000Hz, in OGG.
  • one channels (front, rear, left or right), 16000Hz, in WAV.
  • filename – Absolute Path of the file
  • type – “wav” or “ogg”
  • samplerate – Requested sample rate
  • channels – Requested channels
#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);


  /// Stops the recording and close the file after 10 seconds.

  return 0;
void ALAudioRecorderProxy::stopMicrophonesRecording()

This method stops the recording of the signal collected by the microphones started with ALAudioRecorderProxy::startMicrophonesRecording.