.. _cpp-examples-sound-based-reaction:

Sound based reaction
====================

:ref:`\<\< return to C++ examples<cpp-examples>`

Overview
--------

This example module **ALSoundBasedReaction** makes NAO say "Hello there" each
time a sudden and loud noise is detected.

To do so, it uses the processSound callback method.

This module can be **remote or local**.

Downloads
---------

Whole example
+++++++++++++

:download:`soundbasedreaction.zip <../soundbasedreaction.zip>`

Header: alsoundbasedreaction.h
++++++++++++++++++++++++++++++

:download:`alsoundbasedreaction.h <alsoundbasedreaction.h>`

.. literalinclude:: alsoundbasedreaction.h
   :language: cpp

Source:  alsoundbasedreaction.cpp
+++++++++++++++++++++++++++++++++

:download:`alsoundbasedreaction.cpp <alsoundbasedreaction.cpp>`

.. literalinclude:: alsoundbasedreaction.cpp
   :language: cpp

Main: main.cpp
++++++++++++++++++++++++++++++++

:download:`main.cpp <main.cpp>`

.. literalinclude:: main.cpp
   :language: cpp

CMakeLists.txt
++++++++++++++

:download:`CMakeLists.txt <CMakeLists.txt>`

.. literalinclude:: CMakeLists.txt
   :language: cmake

