Python Snippets =============== .. _system_volume: ------------------ Set speaker volume ------------------ .. code-block:: python import navel with navel.Robot() as robot: print(f"Previous volume: {robot.volume}%") robot.volume += 3 print(f"New volume: {robot.volume}%") -------------------------- Stream audio to Google ASR -------------------------- In your virtual environment, ``pip install pyaudio``. Follow examples on `Github `_. You can configure what microphone to use by adding an ``input_device_index`` in ``self._audio_interface.open()``. To list the available devices with indices, use the following code. .. code-block:: python import pyaudio p = pyaudio.PyAudio() for i in range(p.get_device_count()): print(p.get_device_info_by_index(i)) ------------------------------------ Disable automatic facial expressions ------------------------------------ Facial expressions are in auto-mode by default, which weakens your manual control. You can disable it until restart with the following code. .. code-block:: python import navel with navel.Robot() as robot: robot.config_set("cns_fer_cont_t1", 0, navel.DataType.U32) robot.config_set("cns_fer_cont_t2", 0, navel.DataType.U32) robot.config_set("cns_fer_peak_t1", 0, navel.DataType.U32) robot.config_set("cns_fer_peak_t2", 0, navel.DataType.U32) robot.config_set("cns_fer_overlay_inc", 0, navel.DataType.F32) robot.config_set("cns_fer_overlay_max", 0, navel.DataType.F32) robot.config_set("cns_fer_overlay_peak_min", 0, navel.DataType.F32) robot.config_set("cns_fer_peak_max", 0, navel.DataType.F32)