This module allows to play wav and mp3 files on NAO
int playFile (const string& fileName)
Plays a wav or mp3 file. Asynchronous.
Path of the sound file
Id of the task. Can be used to interrupt it.
Example in Python :
#Launchs the playing of a file #Creates a proxy on the audio player module from naoqi import ALProxy import time aup = ALProxy("ALAudioPlayer",IP,9559);#IP = IP address of the robot aup.playFile("/home/nao/MyWaveFile.wav")
int playFile (const string& fileName, const float& volume, const float& pan)
Plays a wav or mp3 file, with specific volume and audio balance. Asynchronous.
Path of the sound file
volume of the sound file (must be between 0.0 and 1.0)
audio balance of the sound file (-1.0 : left / 1.0 : right / 0.0 : centered)
Id of the task. Can be used to interrupt it.
Example in Python :
#Launchs the playing of a file on the left speaker to a volume of 50% #Creates a proxy on the audio player module from naoqi import ALProxy import time aup = ALProxy("ALAudioPlayer",IP,9559);#IP = IP address of the robot aup.post.playFile("/home/nao/MyWaveFile.wav",0.5,-1.0)
int playFileInLoop (const string& fileName)
Plays a wav or mp3 file in loop. Asynchronous.
Path of the sound file
Id of the task. Can be used to interrupt it.
int playFileInLoop (const string& fileName, const float& volume, const float& pan)
Plays a wav or mp3 file in loop, with specific volume and audio balance. Asynchronous.
Path of the sound file
volume of the sound file (must be between 0.0 and 1.0)
audio balance of the sound file (-1.0 : left / 1.0 : right)
Id of the task. Can be used to interrupt it.
int playFileFromPosition (const string& fileName, const float& position)
Plays a wav or mp3 file from a given position in the file.. Asynchronous.
Name of the sound file
Position in second where the playing has to begin
Id of the task. Can be used to interrupt it.
int playFileFromPosition (const string& fileName, const float& position, const float& volume, const float& pan)
Plays a wav or mp3 file from a given position in the file, with specific volume and audio balance. Asynchronous.
Name of the sound file
Position in second where the playing has to begin
volume of the sound file (must be between 0.0 and 1.0)
audio balance of the sound file (-1.0 : left / 1.0 : right)
Id of the task. Can be used to interrupt it.
void goTo (const int& playId, const float& position)
Goes to a given position in a file which is playing.
Id of the process which is playing the file
Position in the file (in second)
Example in Python :
#Launchs the playing of a file, waits for 2 seconds, and goes go the 5th second #Creates a proxy on the audio player module from naoqi import ALProxy import time aup = ALProxy("ALAudioPlayer",IP,9559);#IP = IP address of the robot #Launchs the playing fileId=aup.post.playFile("/home/nao/MyWaveFile.wav") time.sleep(2) aup.goTo(fileId,5)
void pause (const int& id)
Pause a play back
Id of the process that is playing the file you want to put in pause
void setVolume (const int& id, const float& volume)
Sets the volume of the player
Id of the process that is playing the file you want to put louder or less loud
Volume - range 0.0 to 1.0
void setMasterVolume (const float& volume)
Sets the master volume of the player
Volume - range 0.0 to 1.0
float getMasterVolume ()
Returns the master volume of the player
Volume of the master - range 0.0 to 1.0.
void setPanorama (const float& arg1)
sets the audio panorama : -1 for left speaker / 1 for right speaker
arg
int loadFile (const string& fileName)
Loads a file for ulterior playback
Path of the sound file (either mp3 or wav)
Id of the file which has been loaded. This file can then be played with the play function
void unloadFile (const int& id)
unloads a file previously loaded with the loadFile function
Id returned by the loadFile function
int play (const int& id)
Starts the playback of a file preloaded with the loadFile function.. Asynchronous.
Id returned by the loadFile function
Id of the task. Can be used to interrupt it.
Example in Python :
#Loads a file and launchs the playing 5 seconds later #Creates a proxy on the audio player module from naoqi import ALProxy import time aup = ALProxy("ALAudioPlayer",IP,9559);#IP = IP address of the robot #launchs the playing fileId=aup.loadFile("/home/nao/MyWaveFile.wav") time.sleep(5) aup.play(fileId)
int play (const int& id, const float& volume, const float& pan)
Starts the playback of a file preloaded with the loadFile function, with specific volume and audio balance. Asynchronous.
Id returned by the loadFile function
volume of the sound file (must be between 0.0 and 1.0)
audio balance of the sound file (-1.0 : left / 1.0 : right)
Id of the task. Can be used to interrupt it.
Example in Python :
#Loads a file and launchs the playing 5 seconds later #Creates a proxy on the audio player module from naoqi import ALProxy import time aup = ALProxy("ALAudioPlayer",IP,9559);#IP = IP address of the robot #launchs the playing fileId=aup.loadFile("/home/nao/MyWaveFile.wav") time.sleep(5) aup.play(fileId,1.0,0.0)
int playInLoop (const int& fileName)
Starts the playback in loop of a file preloaded with the loadFile function. Asynchronous.
Path of the sound file
Id of the task. Can be used to interrupt it.
int playInLoop (const int& fileName, const float& volume, const float& pan)
Plays a wav or mp3 file in loop, with specific volume and audio balance. Asynchronous.
Path of the sound file
volume of the sound file (must be between 0.0 and 1.0)
audio balance of the sound file (-1.0 : left / 1.0 : right)
Id of the task. Can be used to interrupt it.
string version ()
Returns the version of the module.
A string containing the version of the module.
AL::ALValue getMethodHelp (const string& methodName)
Retrieves a method's description.
The name of the method.
A structure containing the method's description.
AL::ALValue getModuleHelp ()
Retrieves the module's description.
A structure describing the module.
string getUsage (const string& name)
Gets the method usage string. This summarise how to use the method.
The name of the method.
A string that summarises the usage of the method.