ALAudioPlayer

NAOqi Audio - Overview | API


What it does

ALAudioPlayer provides playback services for multiple audio file format and the associated common functionalities (play, pause, stop, loop, etc...). The resulting audio stream is in all cases sent to the robot’s loudspeakers.

How it works

ALAudioPlayer relies on several decoding Linux libraries (mainly Gstreamer and SNDFile) to efficiently decode and stream to audio outputs a good variety of audio file formats.

Sound file storage

The files containing sounds must be uploaded on the robot:

Syntax

  • A single sound file is called using its absolute path:

    
                   
                    fileId = aup.post.playFile("/usr/share/naoqi/wav/filename.wav")
    
                   
                  
  • Once a soundSet is loaded, a sound file stored in a soundSet is called using its name:

    
                   
                    ap.loadSoundSet("Aldebaran")
    fileId = ap.post.playSoundSetFile("filename")
    
                   
                  

Soundset

A soundSet contains .ogg or .wav files.

The SoftBank Robotics soundSet is available trough the nao Basic Channel or pepp Basic Channel .

Performances and Limitations

Loading/starting time

Efficiency has been optimized to reach the lowest time of reaction when loading/starting a file; but depending on the audio file format, that time can vary.

Tips : uncompressed WAV files should be preferred to any other compressed file format, particularly for applications requiring very low loading/starting times.

MP3 files not well supported

  • On a virtual robot, AlAudioPlayer can play OGG and WAV files but not MP3 .
  • On a real robot, there is a known issue occuring exclusively with MP3 files, so prefer OGG or WAV files.

Getting started

To start using ALAudioPlayer , see the tutorial: Playing music .