## For instruction on writing tutorials ## http://www.ros.org/wiki/WritingTutorials #################################### ##FILL ME IN #################################### ## for a custom note with links: ## note.0= [[ROS/Tutorials|ROS tutorials]] ## descriptive title for the tutorial ## title = How to capture, stream, and play audio using audio_capture and audio_play. ## multi-line description to be displayed in search ## description = This tutorial covers the audio_capture and audio_play packages. The audio_capture package records audio from a microphone and publishes audio messages on the /audio topic. The audio_play package listens to /audio and outputs the audio messages to speakers. ## the next tutorial description (optional) ## next = For remote robot teleoperators, ## links to next tutorial (optional) ## next.0.link= [[audio_common/Tutorials/Remotely%20listening%20through%20robot%20ears| learn how to remotely listen through robot ears]] ## what level user is this tutorial for ## level= BeginnerCategory ## keywords = audio, sound, stream #################################### <> <> == Installation == * Install ROS: [[ROS/Installation | Installation Instructions]] * Instructions for Ubuntu * Install from debs; replace with the ROS distribution you're using (eg. fuerte) . {{{ sudo apt-get install ros--audio-common }}} * Instructions for other Linux distributions * Install git . {{{ sudo aptitude install git }}} * Download code . {{{ cd ~/catkin_ws/src git clone https://github.com/ros-drivers/audio_common.git }}} * Install dependencies . {{{ rosdep install audio_common }}} * Build audio_common along with your other ROS packages . {{{ cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash }}} == Testing Your Setup == Test that gstreamer is working successfully with ALSA by capturing audio from your microphone and playing it back through your speakers. Before executing the following command, make sure your microphone is enabled and selected as your default audio input device. You may want to turn down your volume as well. {{{gst-launch-0.10 alsasrc ! audioconvert ! audioresample ! alsasink }}} If the above command doesn't work, try using the command "gst-launch-1.0" instead of the command "gst-launch-0.10". The above command should play audio from the microphone through the speakers. If no audio is heard, make sure your system settings take audio input from your intended source as default. It may be helpful to debug whether audio from your source is being received using an external audio recording program such as audacity. Once it is working, control-c the script to stop it. == Capturing sounds == Start capturing audio data using the following command {{{ roslaunch audio_capture capture.launch }}} This will produce an /audio topic. Check for its existence using: {{{ rostopic list }}} Check to see if it is streaming any data: {{{ rostopic hz /audio }}} Do not kill this node, and continue to the next section. == Listening to captured sounds == Once the audio_capture node is running, we can use the audio_play node to listen to the output. Open a new terminal, and source your ROS workspace variables. {{{ source ~/catkin_ws/devel/setup.bash }}} Now launch the audio_play node. {{{ roslaunch audio_play play.launch }}} This will start a new node that listens to the /audio topic, and plays the incoming messages. ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## FILL IN THE STACK TUTORIAL CATEGORY HERE