-
Notifications
You must be signed in to change notification settings - Fork 2
Using a USB Microphone with ROS2
Disclaimer: This tutorial was made using an Audio-Technica ATR4650-USB microphone. This may not work perfectly with other microphones.
The required ROS package (audio-common) has been forked and slightly modified here:
cd $HOME/ros2_ws/src
git clone [email protected]:norlab-ulaval/audio_common.git
Make sure you use the ros2
branch with git status
.
Install required dependencies using:
sudo apt install -y pulseaudio alsa-base alsa-tools alsa-utils
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-*
Compile your workspace with the new package installed with:
cd $HOME/ros2_ws
colcon build --symlink-build
source install/local_setup.bash
Launch the audio_capture node using:
ros2 launch audio_capture capture.launch.py
In another terminal, run:
ros2 topic echo /audio/audio
You should see arrays of integers coming in with changing values. If there is no topic or the data is always the same, following the debugging steps below. Otherwise, you can validate the functionality of the recording by launching:
ros2 launch audio_capture capture_to_file.launch.py
Which will create a file called output.mp3
in /tmp
. Download this file on your machine and listen to your "bee boop bee boop" sounds.
If the driver is not working, first check if the microphone is detected by Ubuntu in Settings->Sound. You should see you microphone in the "Input" section, with the line moving when you make noise.
If the topic /audio/audio
is sending the same message over and over, edit the file /etc/modprobe.d/alsa-base.conf
so the end looks like this:
# Keep snd-usb-audio from being loaded as first soundcard
#options snd-usb-audio index=-2
options snd-hda-intel index=0
options snd-usb-audio index=1 vid=0x0909 pid=0x004f
Note1: Make sure to comment the first line which is already present in the file.
Note2: Replace the vid and pid with the values for your microphone (found using lsusb).
More ressources here: https://help.ubuntu.com/community/UbuntuStudio/UsbAudioDevices
- Warthog Teach and Repeat (ROS1)
- Warthog Teach and Repeat (ROS2)
- Time Synchronization (NTP)
- Time Synchronization (PTP)
- Deployment of Robotic Total Stations (RTS)
- Deployment of the backpack GPS
- Warthog Emlid GPS
- Atlans-C INS
- How to use a CB Radio when going in the forest
- IP forwarding
- Emlid Data Postprocessing (PPK)
- Setting up a reliable robot communication with Zenoh
- Zenoh rmw
- Lessons Learned
- Robots' 3D Models
- Order Management
- Fast track Master → PhD
- Intellectual Property
- Repository Guidelines
- TF Cheatsheet
- Montmorency Forest Wintertime Dataset
- RTS-GT Dataset 2023
- Deschenes2021 Dataset
- TIGS Dataset
- DRIVE Datasets
- BorealHDR
- TimberSeg 1.0
- DARPA Subterranean Challenge - Urban Dataset
- How to upload a dataset to VALERIA
- ROS1 Bridge
- Migrating a repository to ROS2 (Humble)
- ROS2 and rosbags
- MCAP rosbags
- DDS Configuration (work in progress)
- Using a USB Microphone with ROS2
- ROS2 in VSCode
- ROS2 Troubleshooting