No version for distro humble showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro jazzy showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro kilted showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro lyrical showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro rolling showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro ardent showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro bouncy showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro crystal showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro eloquent showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro dashing showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro galactic showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro foxy showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

No version for distro iron showing lunar. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-18
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The emotion_analyzer package

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Ayaha Nagata

emotion_analyzer

Services which estimate the emotions of a text or of a short voice with the streaming API of Hume AI. analyze_text sends a text to the language model of Hume, analyze_audio sends a wave file or the last 2 seconds of an audio_common_msgs/AudioData topic to its prosody and vocal burst models; both return the scores of the emotions (e.g. Joy, Surprise (positive)) as a JSON string.

Requirements

  • An API key of Hume AI: sign up at https://platform.hume.ai/ and create a key in the settings of the platform (API keys). The analysis is done on the servers of Hume, so the node needs the internet.
  • For the analysis of a live voice: a microphone and audio_capture (from audio_common) publishing 16 kHz, 16 bit, mono wave data.
  • Python package hume[stream] (the legacy HumeStreamClient, removed in hume 0.7). It is installed at build time:
    • ROS 1: into a virtualenv by catkin_virtualenv from requirements.in (hume==0.4.2 on python 3.8, hume==0.6.0 on python >= 3.9);
    • ROS 2: into a uv venv (share/emotion_analyzer/venv) from pyproject.toml/uv.lock by jsk_ros1_ros2_compat_generate_uv_venv(). Run uv lock after changing pyproject.toml.

Usage

ROS 2

colcon build --packages-up-to emotion_analyzer
source install/setup.bash
ros2 launch emotion_analyzer emotion_analyzer.launch.xml api_key:=<your_api_key>

Analyze a text:

ros2 service call /analyze_text emotion_analyzer/srv/AnalyzeText "{text: 'I am so happy to see you again'}"

Analyze a wave file of 5 seconds or shorter, e.g. the sample data/purugacha_short.wav (4 s) of the source tree (data/ is not installed; data/purugacha.wav is 8.8 s, too long):

ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio \
  "{audio_file: '$HOME/ros2_ws/src/jsk_3rdparty/emotion_analyzer/data/purugacha_short.wav'}"

Analyze the voice of a microphone: start audio_capture in wave format and call the service with an empty audio_file; the last 2 seconds of /audio/audio are analyzed.

ros2 launch emotion_analyzer sample_emotion_analyzer.launch.xml api_key:=<your_api_key> device:=plughw:1,0
ros2 service call /analyze_audio emotion_analyzer/srv/AnalyzeAudio "{audio_file: ''}"

sample_emotion_analyzer.launch.xml includes capture_wave.launch.xml of the ROS 2 audio_capture.

Launch file Arguments (default)
emotion_analyzer.launch.xml api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch.xml api_key (""), device ("", the ALSA device of audio_capture)

ROS 1

catkin build emotion_analyzer
source devel/setup.bash
roslaunch emotion_analyzer emotion_analyzer.launch api_key:=<your_api_key>

rosservice call /analyze_text "text: 'I am so happy to see you again'"
# data/ is in the source tree (rospack find gives it in a devel space)
rosservice call /analyze_audio "audio_file: '$(rospack find emotion_analyzer)/data/purugacha_short.wav'"

For the voice of a microphone:

roslaunch emotion_analyzer sample_emotion_analyzer.launch api_key:=<your_api_key>
# or start audio_capture yourself
roslaunch audio_capture capture.launch format:=wave device:=plughw:1,0
rosservice call /analyze_audio "audio_file: ''"

Launch file Arguments (default)
emotion_analyzer.launch api_key (""), input_audio (/audio/audio)
sample_emotion_analyzer.launch api_key (""); there is no device argument, audio_capture uses its default device

Microphone tips

  • List the devices with arecord -l. Sometimes hw must be plughw, e.g. device:=plughw:1,0.
  • When the device is busy, find the process with fuser -v /dev/snd/* and stop it.

Interface

analyze_text_service.py

Services:

  • /analyze_text (emotion_analyzer/AnalyzeText): request string text, response string result, the JSON {"emotions": [{"name": ..., "score": ...}, ...]} of the first sentence (LanguageConfig(granularity="sentence")), or {"error": "..."}.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package emotion_analyzer

3.0.1 (2026-11-10)

  • Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
  • use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
  • Contributors: Kei Okada

3.0.0 (2026-11-06)

  • Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel

  • [emotion_analyzer] use python3-soundfile from apt instead of the uv venv The numpy wheel pulled by soundfile fails dh_strip of the buildfarm binary job (libscipy_openblas64_*.so). python3-soundfile is already an exec_depend and the venv sees the system site-packages. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into fix_hoya

  • Merge branch 'master' into voicevox-ros1-ros2

  • AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • Merge branch 'master' into ros2-speech-recognition-only

  • Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros

  • AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>

  • [emotion_analyzer] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.

    - CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates the services with rosidl_generate_interfaces(), which already installs the emotion_analyzer python package, so src/emotion_analyzer/utils is installed into it instead of a second ament_python_install_package().

    - package.xml: format 3 for conditions; audio_common_msgs (imported by the scripts but only pulled in by audio_capture before) is listed explicitly. hume has no rosdep key and catkin_virtualenv has no ROS2 port, so ROS2 users pip install it (README.md).

    - analyze_{text,audio}_service.py, utils/audio_buffer.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat, falling back to rospy when it is not importable (jsk_common < 3.0, ROS1 only).

    - launch/emotion_analyzer.launch.xml: ROS2 version of emotion_analyzer.launch.

    - Catch exceptions from the Hume request and return {"error": ...} (same format as the existing no-audio case): rospy only returned a service error, but an exception in a service callback kills the rclpy node.

    - hume (not in apt; catkin_virtualenv has no ROS2 port) is installed into a uv venv made from pyproject.toml/uv.lock at build time with jsk_ros1_ros2_compat_generate_uv_venv() (jsk-ros-pkg/jsk_common#1831), and both services are installed with jsk_ros1_ros2_compat_install_python(... USE_VENV) to run with it, instead of asking users to [pip install hume[stream]]{.title-ref}. hume is pinned below 0.7, since the scripts use the legacy HumeStreamClient that 0.7 removed (the latest hume, 0.14, can not

File truncated at 100 lines see the full file

Launch files

Messages

No message files found.

Plugins

No plugins found.

Recent questions tagged emotion_analyzer at Robotics Stack Exchange