Robotics StackExchange | Archived questions

audio_capture adjustible

I was wondering whether audio_capture has these capabilities:

How can i set different recording parameters: e.g. 16bit resolution, WAV output and 44 Hz sampling frequency? How can i play a prerecorded .wav file to the /audio topic.

Are there any other solutions to stream audio data in binary form on a ROS topic?! Thanks for your help,

Asked by Saragossa on 2015-06-12 02:21:52 UTC

Comments

Answers

It looks like https://github.com/ros-drivers/audio_common/blob/hydro-devel/audio_capture/src/audio_capture.cpp is a thin wrapper around GStreamer, which is very flexible, but the wrapper itself is mostly hardcoded. The source is set to alsasrc (when you would want it to be filesrc, unless you can play your file into alsasrc), and the only parameter is for bitrate, but that is mp3 bitrate.

The encoder is set to lame, which I think means only mp3:

    _encode = gst_element_factory_make("lame", "encoder");

It might be a learning curve to use the gstreamer api but maybe not too hard to hack the existing audio_capture to do what you want (and maybe there are gstreamer experts on stackoverflow)- or even better extend it and push the changes back into the public repo.

Asked by lucasw on 2015-06-12 16:04:25 UTC

Comments

Thanks for your response. I have typed sth. together based on audio_capture that lets me get the rate and format i want. however, it's nowhere as configurable as it could be writen by a gst-expert. The "filesrc" thing is commented by default in the master so i assume sth is wrong with it...

Asked by Saragossa on 2015-06-15 03:39:05 UTC