ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Send .wav files to other ROS module

asked 2016-03-05 06:23:20 -0500

steinaak gravatar image


I am TOTALLY new in ROS. I have a package consisting of two ROS modules where the first module takes input from a microphone and saves it as a ".wav" file. I want this module to publish this ".wav"-file to a topic so that the other ROS module is able to receive it(subscribe the topic). How do I do this? I have been looking at the ROS package called audio_common, but I cant figure out how to do it. Do I need to convert the ".wav"-file into bytes and stuff before sending? I have no idea!

Any advices would help here!

edit retag flag offensive close merge delete


Are you trying to stream audio, or are you trying to capture short bursts? What are you trying to do with the audio samples in the receiving node?

ahendrix gravatar image ahendrix  ( 2016-03-05 14:06:59 -0500 )edit

Hey! Now, the microphone module captures small bursts(.wav files with duration up to 10 seconds). The other module will receive this audio(if I am able to solve that problem) and make a call to an API to translate the speech into text. What message type should I use? And how to do it?

steinaak gravatar image steinaak  ( 2016-03-06 02:53:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-06 03:20:39 -0500

ahendrix gravatar image

There isn't a good audio transport convention in ROS. audio_common_msgs provides the AudioData message, but there's no documented convention about what data it's supposed to carry, and no way to indicate which format the data is in. audio_capture usually uses it for transporting chunks of MP3 streams, but you could use it for wav data too. If you need any kind of metadata with your audio, you should create your own message.

In practice, if you want to do speech recognition I'd recommend the ROS pocketsphinx package. It's what most ROS users use for speech recognition, and it's reasonably well maintained. The only place where it may not work is if you want to do the audio capture and speech processing on two different computers.

edit flag offensive delete link more


Thank you very much for your reply! I have had a look at the pocketsphinx package already, but it seems like you have to build the vocabulary of words to recognize yourself? Or does the pocketsphinx include a vocabulary so it is able to recognize speech already?

steinaak gravatar image steinaak  ( 2016-03-06 05:50:11 -0500 )edit

There are two varieties of speech recognition - dictation and vocabulary-based recognizers. Vocabulary-based recognizers are usually good for commands. Dictation recognizers use a much larger vocabulary are are usually good for "speech typing".

ahendrix gravatar image ahendrix  ( 2016-03-06 15:21:07 -0500 )edit

Thank you! Is there a dictation-recognizer in pocketsphinx that works well?

steinaak gravatar image steinaak  ( 2016-03-07 02:37:11 -0500 )edit

I'm not aware of anyone using pocketsphinx for dictation.

ahendrix gravatar image ahendrix  ( 2016-03-07 12:10:37 -0500 )edit

Question Tools


Asked: 2016-03-05 06:23:20 -0500

Seen: 1,158 times

Last updated: Mar 06 '16