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:
- as a single sound file or
- inside a Soundset.
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")
Performances and Limitations¶
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.