NAOqi Audio - Overview | API
Namespace : AL
#include <alproxies/alaudiodeviceproxy.h>
As any module, this module inherits methods from ALModule API. It also has the following specific methods:
Closes the audio device used for capture by ALAudioDevice. This method is useful to allow an external program (e.g. a record) to access NAO’s input device. Note however that a call to this method will prevent every functionality that uses microphones to work correctly (e.g. ALSpeechRecognition, ALAudioSourceLocalization, etc...).
Closes the audio device used for playback by ALAudioDevice. This method is useful to allow an external program (e.g. a play) to access NAO’s output device. Note however that a call to this method will prevent every functionality that uses microphones to work correctly (e.g. ALTextToSpeech).
Opens the audio device used for capture by ALAudioDevice. This device is open by default. This method is however useful if you used ALAudioDeviceProxy::closeAudioInputs() before.
Opens the audio device used for playback by ALAudioDevice. This device is open by default. This method is however useful if you used ALAudioDeviceProxy::closeAudioOutputs() before.
This methods clears all the samples that may remain to be sent to the loudspeaker.
Disables the computation of the energy on each input channel.
Enables the computation of the energy on each input channel (this computation is off by default). The result of this computation can be collected by calling:
Returns the signal energy on the front microphone averaged on a 170ms buffer. The computation of the energy must first be enabled with ALAudioDeviceProxy::enableEnergyComputation().
Returns: | energy [0,32768] |
---|
Returns the signal energy on the left microphone averaged on a 170ms buffer. The computation of the energy must first be enabled with ALAudioDeviceProxy::enableEnergyComputation().
Returns: | energy [0,32768] |
---|
Returns the signal energy on the rear microphone averaged on a 170ms buffer. The computation of the energy must first be enabled with ALAudioDeviceProxy::enableEnergyComputation().
Returns: | energy [0,32768] |
---|
Returns the signal energy on the right microphone averaged on a 170ms buffer. The computation of the energy must first be enabled with ALAudioDeviceProxy::enableEnergyComputation().
Returns: | energy [0,32768] |
---|
Gets the overall output volume of the system. This volume can be set with ALAudioDeviceProxy::setOutputVolume().
Returns: | volume [0,100] |
---|
This method returns the internal parameter (‘outputSampleRate’ or ‘inputBufferSize’). The value -1 is returned if the specified parameter is not valid.
Parameters: |
|
---|---|
Returns: | value |
Plays a sine wave with the specified characteristics.
Parameters: |
|
---|
By using this method a local module (a module running on NAO) can send a signal to NAO’s loudspeakers. This signal should be formated as a 16 bits stereo interleaved buffer. The size of this buffer should also not exceed 16384.
Parameters: |
|
---|---|
Returns: | True if the operation is successful - False otherwise |
By using this method a remote module (a module running outside NAO) can send a signal to NAO’s loudspeakers. This signal should be formated as a 16 bits stereo interleaved buffer. The size of this buffer should also not exceed 16384.
Parameters: |
|
---|---|
Returns: | True if the operation is successful - False otherwise |
By using this method a module can specify the format of the signal that will be sent after subscribing to ALAudioDevice. If no call to this method is made, the default format sent to this module is 4 channels interleaved at 48000Hz. Note that for now, only the following combinations are available:
This call must be made before the call to ALAudioDeviceProxy::subscribe() or startDetection() to be taken into account.
// This shows how setClientPreferences can be used
boost::shared_ptr<ALProxy> proxyAudioDevice = getParentBroker()->getProxy("ALAudioDevice");
proxyAudioDevice->callVoid("setClientPreferences",
getName(), //Name of this module
48000, //48000 Hz requested
(int)ALLCHANNELS, //4 Channels requested
1 //Deinterleaving requested
);
Parameters: |
|
---|
This method notifies ALAudioDevice that audio inputs should be read in the specified file instead. The specified sound file must be a .wav file containing 48000Hz, 16bits, 4 channels interleaved signals.
Parameters: |
|
---|
Sets the overall output volume of the system. This volume can be collected with ALAudioDeviceProxy::getOutputVolume().
Parameters: |
|
---|
This method sets the internal parameter (‘outputSampleRate’ or ‘inputBufferSize’).
Parameters: |
|
---|
This method records the signal collected on the NAO’s microphones directly into the specified file.
If the extension of the specified file is ‘wav’, data will be recored as a 16 bits, 48000Hz, 4 channels wav file.
If the extension of the specified file is ‘ogg’, data will be recored as a 16 bits, 16000Hz, 1 channels ogg file.
Parameters: |
|
---|
This method stops the recording started by the call to ALAudioDeviceProxy::startMicrophonesRecording().
This function allows a module which inherits from the ALSoundExtractor class to subscribe to the ALAudioDevice module. Once the module is subscribed, the function ‘process’ of the module (the module needs to contain one) will be automatically and regularly called with raw data from microphones as inputs. The call to this method can be replaced by a call to startDetection() within a NAOqi module that inherits from ALSoundExtractor.
The callback function must be declared as follows:
process(const int & nbOfChannels, const int & nbrOfSamplesByChannel, const AL_SOUND_FORMAT * buffer, const ALValue & timeStamp)
Parameters: |
|
---|
Deprecated since version 1.12: use ALAudioDeviceProxy::subscribe() instead.
param module: | name of the module inheriting from ALSoundExtractor |
---|---|
return: | True if module has subscribed successfully - False otherwise |
Deprecated since version 1.12: use ALAudioDeviceProxy::unsubscribe() instead.
param module: | Name of the module inheriting from ALSoundExtractor |
---|---|
return: | True if module has unsubscribed successfully - False otherwise |
This function allows a module which inherits from the ALSoundExtractor class to unsubscribe from the ALAudioDevice module. This stops the regular calls to the module callback “process”. The call to this method can be replaced by a call to stopDetection() within a NAOqi module that inherits from ALSoundExtractor.
Parameters: |
|
---|