Skip to content

firephinx/sounddevice_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sounddevice_ros

This ROS Catkin package is a wrapper around the sounddevice python package located here: https://python-sounddevice.readthedocs.io/en/0.3.13/

Installation Instructions

  1. Install sounddevice and soundfile:
    pip install sounddevice pysoundfile
  2. Install PortAudio and ASound:
    sudo apt-get install libportaudio2 libasound-dev
  3. Clone this repository into your catkin_ws/src folder:
    cd ~/catkin_ws/src
    git clone https:/firephinx/sounddevice_ros.git
  4. Run catkin_make in your catkin_ws folder:
    cd ..
    catkin_make

Run Instructions

  1. Source the devel/setup.bash and start the sound device publisher:
    source devel/setup.bash
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py
  2. Open a new terminal, source the devel/setup.bash, and start the sound device subscriber:
    source ~/catkin_ws/devel/setup.bash
    rosrun sounddevice_ros sounddevice_ros_subscriber_node.py

Options

Sounddevice ROS Publisher Node

  1. You can list available devices by first running:
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -l
  2. You can select your desired input device by using the -d flag:
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -d <device id or substring>
  3. You can set the sample rate by using the -r flag:
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -r <sample_rate>
  4. You can set the number of channels by using the -c flag (default is 1):
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -c <num_channels>
  5. You can set whether to save the audio to a wav file using the -s flag (default is False):
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -s True
  6. If you want to save the audio to a wave file, you can set the filename (default is a random temp filename):
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -s True [Filename]
  7. If you want to set the subtype for soundfile saving, you can use the -t flag:
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -t PCM_24

Sounddevice ROS Subscriber Node

  1. You can set the filename that the audio will be saved to (default is a random temp filename):
    rosrun sounddevice_ros sounddevice_ros_subscriber_node.py [Filename]
  2. If you did not already set the subtype for soundfile saving when starting the publisher node, you can use the -t flag:
    rosrun sounddevice_ros sounddevice_ros_publisher_node.py -t PCM_24

About

ROS Python Catkin Wrapper for SoundDevice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published