ALSoundDetection API

NAOqi Audio - Overview | API


Namespace : AL

#include <alproxies/alsounddetectionproxy.h>

Method list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class ALSoundDetectionProxy

Event list

Methods

AL::ALValue ALSoundDetection::getDescription(const std::string& type, const std::string& nameDesc)

Deprecated since version 1.12: use the ALMemory key “SoundDetected” instead to collect the result of the detection.

param type:Name of detector
param nameDesc:Name of the description
return:Description

AL::ALValue ALSoundDetection::getEvents(const std::string& type)

Deprecated since version 1.12: use the ALMemory key “SoundDetected” instead to collect the result of the detection.

param type:Name of detector
return:Event

void ALSoundDetection::setParameter(const std::string& parameter, const float& value)

The sensitivity of the detection can be set by calling this function as follows:

Parameters:
  • parameter – Name of the parameter
  • value – Value of the parameter
import sys
from naoqi import ALProxy

if (len(sys.argv) < 2):
    print "Usage: 'python sounddetection_setparameter.py IP [PORT]'"
    sys.exit(1)

IP = sys.argv[1]
PORT = 9559
if (len(sys.argv) > 2):
    PORT = sys.argv[2]
try:
    sd = ALProxy("ALSoundDetection", IP, PORT)
except Exception,e:
    print "Could not create proxy to ALMotion"
    print "Error was: ",e
    sys.exit(1)

# Sets the sensibility of the detection to 0.3 (less sensitive than default).
# The default value is 0.9.
sd.setParameter("Sensibility", 0.3)
print "Sensibility set to 0.9"
void ALSoundDetection::setParameter(const std::string& type, const std::string& parameter, const float& value)

Deprecated since version 1.12: use ALSoundDetection::setParameter() instead.

Parameters:
  • type – Name of detector
  • parameter – Name of the parameter
  • value – Value of the parameter
void ALSoundDetection::subscribe(const std::string& name)

Subscribes to ALSoundDetection. This causes the module to start writing information to ALMemory in “SoundDetected”. This can be accessed in ALMemory using ALMemoryProxy::getData().

Parameters:
  • name – Name to identify the subscriber
void ALSoundDetection::unsubscribe(const std::string& name)

Unsubscribes to ALSoundDetection. This causes the module to stop writing information to ALMemory in “SoundDetected”.

Parameters:

Events

Event: "SoundDetected"
callback(std::string eventName, AL::ALValue value, std::string subscriberIdentifier)

Raised when a significant sound has been detected.

Parameters:
  • eventName (std::string) – “SoundDetected”
  • value – Detected sound informations. Please refer to ALSoundDetection for details.
  • subscriberIdentifier (std::string) –