|
audio_common for ROS 2
|
This repositiory provides a set of ROS 2 packages for audio. It provides a C++ version to capture and play audio data using PortAudio.
| ROS 2 Distro | Branch | Build status | Docker Image | Documentation |
|---|---|---|---|---|
| Foxy | main | |||
| Galactic | main | |||
| Humble | main | |||
| Iron | main | |||
| Jazzy | main | |||
| Kilted | main | |||
| Rolling | main |
You can create a docker image to test audio_common. Use the following command inside the directory of audio_common.
After the image is created, run a docker container with the following command.
Node to obtain audio data from a microphone and publish it into the audio topic.
format: Specifies the audio format to be used for capturing. Possible values are:
1 (paFloat32 - 32-bit floating point)2 (paInt32 - 32-bit integer)8 (paInt16 - 16-bit integer)16 (paInt8 - 8-bit integer)32 (paUInt8 - 8-bit unsigned integer)Default: 8 (paInt16)
The integer values correspond to PortAudio sample format flags.
1 for mono and 2 for stereo. Default: 116000512-1 indicates that the default audio input device should be used. Default: -1""audio_common_msgs/msg/AudioStampedNode to play the audio data obtained from the audio topic.
1 for mono and 2 for stereo. Default: 2-1 indicates that the default audio output device should be used. Default: -1audio_common_msgs/msg/AudioStampedNode to play music from audio files in wav format.
2048""audio_common_msgs/msg/AudioStampedaudio_common_msgs/srv/MusicPlayaudio: Name of a built-in audio sample (e.g., "elevator")file_path: Path to a custom WAV file (ignored if audio is specified)loop: Boolean to indicate if the audio should loop. Default: falsestd_srvs/srv/Triggerstd_srvs/srv/Triggerstd_srvs/srv/TriggerNode to generate audio from text (TTS) using espeak.
4096""audio_common_msgs/msg/AudioStampedaudio_common_msgs/action/TTStext: The text to convert to speechlanguage: The language to use for speech synthesis. Default: "en"volume: The volume of the generated speech (0.0-1.0). Default: 1.0rate: The speech rate (1.0 is normal speed). Default: 1.0audio: The audio being currently playedtext: The text that was converted to speechAdvanced TTS example with additional parameters:
Play a built-in sample:
Play a custom WAV file:
Play with looping enabled:
Control playback: