NAOqi Audio - Overview | API
ALAudioDevice provides other NAOqi modules with an access to NAO’s audio inputs (microphones) and outputs (loudspeakers).
Every NAOqi module intended to process signals coming from NAO’s microphones or that needs to send signals to NAO’s loudspeakers should use the API provided by ALAudioDevice.
ALAudioDevice is based on the standard Linux ALSA (Advanced Linux Sound Library) library to communicate with NAO’s sound driver and subsequently to microphones and speakers.
Any NAOqi module can send data to NAO’s loudspeakers by calling, when needed, one of the two appropriate ALAudioDevice methods. Provided that the data is correctly formated, such a call can be made without having to configure anything else.
To process data coming from the microphones, the procedure is different. Indeed, a NAOqi module willing to process such data will first “subscribe” to ALAudioDevice and specify the format of the data that it requires (number of channels, sample rate, etc...). The data correctly formated will then be automatically and regularly sent to the requesting module by using one of its methods as a callback.
ALAudioDevice can provide the sound coming from the microphones formated in one of these ways:
ALAudioDevice can send data to loudspeakers in one of these following framerate:
To get started about writing a NAOqi module that can process NAO’s microphones data, please refer to the following example that can be used as a nutshell:
To get started about writing a NAOqi module that can send data to NAO’s loudspeakers, please refer to the following example:
The projects (that can be easily compiled) corresponding to these files can be found in the audio examples directory.