ros-drivers / audio_common Goto Github PK
View Code? Open in Web Editor NEWCommon code for working with audio in ROS
License: BSD 3-Clause "New" or "Revised" License
Common code for working with audio in ROS
License: BSD 3-Clause "New" or "Revised" License
The hydro package of sound_play does not include the header file. The CMake file lacks a proper install rule like this:
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h")
(as mentioned on http://answers.ros.org/question/100941/sound_playh-not-in-included-in-ros-hydro-sound-play/)
As reported in detail in the QA thread ( http://answers.ros.org/question/3212/sound_play-consumes-high-cpu-and-makes-strange), soundplay_node.py instance doesn't stop increasing under certain circumstance and consume significant amount of CPU which makes it hard to keep running everything on the same computer.
trac data:
I get the following error trying to run the code:
bwi@calculon:~$ rosrun sound_play soundplay_node.py
Traceback (most recent call last):
File "/opt/ros/hydro/lib/sound_play/soundplay_node.py", line 368, in <module>
soundplay()
File "/opt/ros/hydro/lib/sound_play/soundplay_node.py", line 304, in __init__
rootdir = os.path.join(roslib.packages.get_pkg_dir('sound_play'),'sounds')
NameError: global name 'roslib' is not defined
I believe this change is responsible:
f5a1355#diff-c4ecd77ae058b18c549f3b287bd340b4R304
As far as I can tell, roslib is never imported, and that seems to be the only error. I'll submit a PR.
My setup: Ubuntu 12.04 with the latest Hydro Debian install. Here's how to reproduce the problem:
$ rosrun sound_play soundplay_node.py
$ rosrun sound_play playbuiltin.py 1
Playing sound 1.
No sound is heard and back in the soundplay_node terminal we see:
[INFO] [WallTime: 1384872577.704429] sound_play node is ready to play sound
[ERROR] [WallTime: 1384872581.128748] Error: URI is invalid: /opt/ros/hydro/lib/sound_play/../sounds/BACKINGUP.ogg
[ERROR] [WallTime: 1384872581.129216] Exception in callback: local variable 'uri' referenced before assignment
[INFO] [WallTime: 1384872581.129848] Traceback (most recent call last):
File "/opt/ros/hydro/lib/sound_play/soundplay_node.py", line 227, in callback
self.builtinsounds[data.sound] = soundtype(params[0], params[1])
File "/opt/ros/hydro/lib/sound_play/soundplay_node.py", line 88, in __init__
self.uri = uri
UnboundLocalError: local variable 'uri' referenced before assignment
And then I will fix this:
/opt/ros/indigo/lib/python2.7/dist-packages/sound_play/libsoundplay.py:89: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.pub = rospy.Publisher('robotsound', SoundRequest)
The sound_play package is missing a dependency on actionlib, only actionlib_msgs are defined in package.xml.
This causes build breakage for any code using SoundClient() on a clean machine, for example here:
https://travis-ci.org/felixduvallet/audio_common/builds/92227443
Hi,
Some codes to call sound_play to play a wav file that i have writen are:
sound_play::SoundClient sc;
const char *str2 = "/home/turtlebot/Desktop/ros/Welcome.wav";
sc.startWave(str2);
then run the codes, the error is :
[ERROR] [1469534489.657482555]: Client [/sound_play] wants topic /robotsound to have datatype/md5sum [sound_play/SoundRequest/f194e75f1c3bf7a3e1e8b16bc9ef7c2a], but our version has [sound_play/SoundRequest/d098ce4a040686259137ece23a625167]. Dropping connection.
what should i do? How to change the version of robotsound?
I'm seeing this backtrace out of soundplay_node.py when trying to run the sound test on a PR2 on electric with the latest release of the sound_play stack.
[ERROR] [WallTime: 1324328714.747158] Exception in callback: playbin
[INFO] [WallTime: 1324328714.747907] Traceback (most recent call last):
File "/opt/ros/electric/stacks/audio_common/sound_play/scripts/soundplay_node.py", line 216, in callback
self.voicesounds[data.arg] = soundtype(wavfilename)
File "/opt/ros/electric/stacks/audio_common/sound_play/scripts/soundplay_node.py", line 75, in init
self.sound = gst.element_factory_make("playbin","player")
ElementNotFoundError: playbin
It looks like this goes back to this changeset: https://kforge.ros.org/audiocommon/audio_common/file/4bce526be63f/sound_play/scripts/soundplay_node.py
Please test on the PR2 before releasing, so that we don't have any more surprises like this.
This is blocking a final version of the PR2 installer and shipment of PR2s.
trac data:
Could you please describe the format of the data field in the messages created by an audio_capture node (audio_common_msgs/AudioData)?
From what I could tell, the output is written from a gst.Buffer with entries of type signed long. However, this is strange because the number of bytes of the data field is sometimes odd, when is should be a multiple of 4 (the size of a long).
In the end, I need to obtain the audio data with respect to time from rosbags of the output of an audio_capture node.
trac data:
I found a memory leak when not unrefing the buffer in the onNewBuffer() callback
here is a patch:
fixed memory leak
diff --git a/audio_capture/src/audio_capture.cpp b/audio_capture/src/audio_capture.cpp
--- a/audio_capture/src/audio_capture.cpp
+++ b/audio_capture/src/audio_capture.cpp
@@ -92,6 +92,8 @@
server->publish(msg);
gst_buffer_unref(buffer);
trac data:
Hi,
whenever I try to play a sound or say text, the sound node generates this error and introduces a delay in playing:
[v01d@kanji ~]$ rosrun sound_play soundplay_node.py
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
[INFO] [WallTime: 1397402403.034453] sound_play node is ready to play sound
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
I have added a new node (and msg) that enables the ability to capture timestamped audio (in raw). This would be useful for precisely determining when captured sounds happen, such as the click from an SLR camera, and then they can be synchronised with other sensors.
Here is a patch in case this can be added to the project.
trac data:
Create a parameter and a syntax to configure the output device for soundplay_node. This allows sound to be configured on a non-default device, and allows output to multiple devices.
trac data:
Hi,
we provide a wav content with the bitrate of 16kbps for the audio_play to play, it is ok. Now, if the bitrate is another one, for example 256kbps, what shoud we do? Should we change the bitrate of the wav content? Should some one help me?
thanks
CMakeLists.txt
in the test directory has the build target set to test
which apparently clashes with some other cmake
builtin resulting in the test not being compiled.
I have try to use wav file for out put, then i download the source code of audio_capture, and change the code : ros::param::paramstd::string("~format", _format, "mp3"); to ros::param::paramstd::string("~format", _format, "wave"); when i run the project, it get an error: [ERROR] [1466752230.167599944]: Unsupported media type. i try to look for more information, it's return is "false" from the code : link_ok = gst_element_link_many( _source, _sink, NULL);
Could some one kindly help me? thanks.
I'd like to use wav file type at audio_capture and audio_play.
So, I write a patch for using wav file. It can change data format by parameter.
trac data:
I found a memory leak when not unrefing the buffer in the onNewBuffer() callback
attached is a patch
trac data:
Looks like the sound engine has changed enough to make the documentation of date. One example on this page:
http://www.ros.org/wiki/sound_play/Tutorials/ConfiguringAndUsingSpeakers
The asoundconf program does not seem to be installed as of 12.04 (maybe earlier).
trac data:
While the documentation of the sound_play node says that more than one sound at a time can be played, this appears not to be the case (even when calling it from the same node).
Lines 181-182 of soundplay_node.py are "Force only one sound at a time" and "self.stopall()". Commenting out the latter seems to allow multiple sounds to be played at once.
Either the documentation or the code should probably be changed, however, I have not experimented significantly to determine whether commenting out line 182 of soundplay_node.py leads to undesirable effects.
trac data:
If a user is logged in, then only that user and sometimes root can play audio. For sound_play on robots, sometimes we have a GUI user that logs in, but other users or scripts play noises from the background.
I tested this on Ubuntu 12.04 64 bit with Fuerte.
trac data:
the sound_play node is missing a rosdep on python-gst0.10, so it doesn't pull in the proper dependencies on new ros installs.
This is blocking shipping new PR2s with Electric. Please fix.
trac data:
We faced troubles during building this stack for the Raspberry Pi.
During catkin_make an error on the dependencies in CMakeLists.txt occurs.
We could solve this issue by removing line 18 in CMakeLists.txt (add_dependencies(audio_play, ........).
Is this a bug?
I'd like to use wav file type at audio_capture and audio_play.
So, I write a patch for using wav file. It can change data format by parameter.
trac data:
I need to confirm that audio_common builds and installs properly on Hydro, and then release HEAD as 0.2.5
I can't find a way a make sound_play work. I've been searching for days already, but I can't find a fix to this error. Have any of you ever experienced this error?
$ rosrun sound_play say.py 'Hello again'
Saying: Hello again Voice: voice_kal_diphone Traceback (most recent call last): File: "/opt/ros/indigo/lib/sound_play/say.py", line 79, in print 'Volume: %s' % volume NameError: name 'volume' is not defined
Is there an easy way to use audio_capture to record bag files from multiple microphones?
Please release this module for the upcoming ros distribution indigo.
It compiles/runs fine with indigo, although I would propose to rename sound_play's "test" binary. This target name officially reserved by cmake and cmake warns about it.
After this steps:
On a Ubuntu 15.05 64-bit system running ROS Jade:
After following the tutorial here: http://wiki.ros.org/audio_common/Tutorials/Streaming%20audio
and installing from source audio_capture had an unmet dependency on gstreamer-0.10.
However, audio_capture still had the missing dependency. Finally
Shouldn't this already happen on rosdep install audio_common?
Output:
$ rosrun sound_play soundplay_node.py
Traceback (most recent call last):
File "/opt/ros/source/audio_common/sound_play/scripts/soundplay_node.py", line 49, in
from diagnostic_msgs.msg import DiagnosticStatus, KeyValue, DiagnosticArray
ImportError: No module named diagnostic_msgs.msg
It looks like this is due to a missing dependency in the manifest.xml file; please look at and fix.
trac data:
Testing email
trac data:
Please :)
From experience, the soundplay_node crashes after running for an extended period of time.
Poking at it a bit more, it appears to be leaking open file descriptors, and when it hits the OS limit of 1024 open file descriptors, it's unable to create or play sounds and crashes.
trac data:
There are currently no unit tests in audio_common.
Add at least basic unit tests to ensure that the API is stable and that method calls succeed.
trac data:
/opt/ros/indigo/lib/python2.7/dist-packages/sound_play/libsoundplay.py:89: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
self.pub = rospy.Publisher('robotsound', SoundRequest)
According to ROS Indigo - the line should be:
self.pub = rospy.Publisher('robotsound', SoundRequest, queue_size=1)
Having an actionlib or actionlib-like library for sound playback would be good. See http://answers.ros.org/question/11281/sound_play-action-library/
Of careful consideration should be the continued ability to have multiple sounds playing simultaneously.
trac data:
sound_play seems to occupy audio device files, preventing non-ROS
applications from using sound. Many users have non-ROS applications, like
screen readers for the blind, which need to run.
trac data:
(I came across this while working on #64, personally I have no use for this functionality but I figured it would be good to report).
The SoundClient's repeat()
method does not appear to actually repeat the sound (instead it just plays it one time).
MWE:
def play_repeat():
soundhandle = SoundClient()
rospy.sleep(0.5)
sound_beep = soundhandle.waveSound("say-beep.wav")
sound_beep.play()
rospy.sleep(1)
sound_beep.repeat()
rospy.sleep(5)
The first call plays the sound once, as expected.
The second call is expected to play the sound "repeatedly until stop() is called," but it also only plays it one time.
Tested on Ubuntu 14.04 with ros indigo.
Hi, the normal things are, it captures the audio data from audio_capture and publish the data on the topic "audio", then the audio_play subscribe the topic "audio" to get data and play it. Now, the things are changing, first it get the data from audio_capture and then do some thing to change the data and publish the changed data on a new topic, for example "audio_test", so, how to change the subscriber of audio_play to play the new topic's data?
Why to change the data of audio_capture? first it get data from audio_capture, then change the audio data to text, maybe the text is a question, then we need to find an answer for it, when we get the answer, we should change the answer to audio and play it.
Would any one help me?
thanks
Here's my test case: I launch audio_play and audio_capture in separate terminals. All works fine but when I terminate audio_capture and restart it, just silence is delivered.
The same problem occurs when playing the /audio topic from a bag file.
The problem doesn't occur when I use a file sink instead the alsasink.
The gstreamer log says nothing except
0:02:59.233072514 17796 0x7faecc04e120 WARN pulse pulsesink.c:651:gst_pulsering_stream_underflow_cb:<sink-actual-sink-pulse> Got underflow
when I terminate audio_capture. When I restart audio_capture the log says nothing on the info level. On the debug level it is still very verbose. I can't see a difference between the debug logs when it's working and when not. In the debug log there are messages from the source, the decoder, the converter and the sink.
The onAudio
callback gets called as it should be and g_signal_emit_by_name
returns successful.
I also checked that the pipeline is in PLAYING state all the time.
I checked this problem on two different machines with Ubuntu 14.04 and Indigo.
As this doesn't appear with a file sink I suspect either the decoder, converter or the sink. Does anyone have an idea how to fix this or how to further debug this?
Edit: The gstreamer graph is identical in both cases. I plotted them with GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS().
Hi,
I would like to report that while following the tutorial steps for audio_common, ( http://www.ros.org/wiki/audio_common/Tutorials/Streaming%20audio ) , at the step for installing the ROS dependencies I encounter the error:
shanker@StudioXPSubuntu:~/Workspace/Aux-ROS-Packages/audio_common$ rosdep install audio_common
Failed to find rosdep gstreamer for package sound_play on OS:ubuntu version:10.04
Failed to find rosdep festival for package sound_play on OS:ubuntu version:10.04
Failed to find rosdep gstreamer for package audio_capture on OS:ubuntu version:10.04
Failed to find rosdep gstreamer for package audio_play on OS:ubuntu version:10.04
ERROR: ABORTING: Rosdeps [u'gstreamer', u'festival', u'gstreamer', u'gstreamer'] could not be resolved
I suppose the solution would be to ignore that and install these packages from Synaptic Package Manager for example. I have done so and installed 'libgstreamer0.10', 'libgstreamer0.10-dev', 'libgstreamermm-0.10-dev' and 'festival' from Synaptic Package Manager.
I then followed the rest of the tutorial, and at the step "Testing your setup" upon execution of the command 'gst-launch-0.10 alsasrc ! audioconvert ! audioresample ! alsasink', I do hear my input being played back to me, with a little delay.
However, at the final step of using audio_capture and audio_play, I do not hear any output. I would also like to note that I have also recorded a bag file while running audio_capture, and the bag file did not have any data under the /audio topic.
I wonder if the problem is with the aforementioned 'rosdep' issue, and that I have installed an incorrect dependency. On the other hand, could it be that I am using a Macbook and the soundcard in question is not handled by audio_capture?
Thank you,
Regards,
Shanker Keshavdas
Researcher , DFKI Saarbruecken,
Germany
trac data:
I'd like to use wav file type at audio_capture and audio_play.
So, I write a patch for using wav file. It can change data format by parameter.
trac data:
Hi,
I want to catch the end event of sound_play's playing when I requested some sound resource to play, but how can I do this?
(I would like to wait until speaking finish)
Or is it able to do this?
Thanks
I have added a new node (and msg) that enables the ability to capture timestamped audio (in raw). This would be useful for precisely determining when captured sounds happen, such as the click from an SLR camera, and then they can be synchronised with other sensors.
Here is a patch in case this can be added to the project.
trac data:
Implement a library for audio transport over ROS that has the appropriate metadata and abstraction for different sound encoding schemes and compressions.
Detailed spec to be filled in by Mike Ferguson.
trac data:
There is currently no Jade Debian package yet. It would be great if we could simply bump the gbp release and rollout the nice new package. Right now, I am compiling it from scratch to use it with Jade.
For the 'say' command, soundplay_node.py creates a couple of files in /tmp, i.e. play_sound_text_temp.txt and play_sound_wave_temp.wav, but doesn't set their permissions to be non-owner writable.
Migrated from: https://code.ros.org/trac/wg-ros-pkg/ticket/3768
Engineers at Google would like to use and commit back to this project but currently cannot due a lack of a license file. Can someone add a BSD license to this repository?
with several hours running soundplay_node.py
, this node crashes with error "Too many open files".
(soundplay_node.py:4545): GStreamer-CRITICAL **: gst_poll_free: assertion `set != NULL' failed
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
(soundplay_node.py:4545): GStreamer-CRITICAL **: gst_poll_write_control: assertion `set != NULL' failed
(soundplay_node.py:4545): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 24:Too many op
en files
(soundplay_node.py:4545): GStreamer-CRITICAL **: gst_poll_free: assertion `set != NULL' failed
(soundplay_node.py:4545): GStreamer-CRITICAL **: gst_poll_write_control: assertion `set != NULL' failed
(soundplay_node.py:4545): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 24:Too many op
en files
(soundplay_node.py:4545): GStreamer-CRITICAL **: gst_poll_free: assertion `set != NULL' failed
can't open /proc/cpuinfo
: Too many open files
Maybe forgot to close file descriptor after playing audio file?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.