Comments (15)
thank you! it worked as expected in master branch
from audio_common.
This bug is still present on deb package.
from audio_common.
Can confirm this. I'm also running 14.04 with indigo.
from audio_common.
The latest version seems still has bugs, but this one works: https://github.com/yann-bourrigault/audio_common
from audio_common.
In my environment with current master branch, I cannot reproduce this issue and I can repeat the wave play multiple times.
from audio_common.
can you share me your testing code?
I tested the following codes with current master branch, and it works.
import rospy
import sys
from sound_play.libsoundplay import SoundClient
def play_repeat():
soundhandle = SoundClient()
rospy.sleep(0.5)
sound_beep = soundhandle.waveSound("say-beep.wav")
sound_beep.play()
rospy.loginfo('first beep')
rospy.sleep(1)
for i in range(100):
sound_beep.repeat()
rospy.loginfo('repeat beep: {}'.format(i))
if rospy.is_shutdown():
break
rospy.sleep(1)
if __name__ == '__main__':
rospy.init_node('repeat_test')
play_repeat()
sys.exit(0)
from audio_common.
Thanks for reply.
Should I run the "repeat()" in a loop?
But the "test.cpp" in Code API seems not in a loop in one test:
sleepok(2, nh);
sound_play::Sound s1 = sc.waveSound("/usr/share/xemacs21/xemacs-packages/etc/sounds/boing.wav");
s1.repeat();
sleepok(1, nh);
s1.stop();
void sound_play::SoundClient::Sound::repeat ( )
Play the Sound repeatedly.
This method causes the Sound to be played repeatedly until stop() is called.
Definition at line 98 of file sound_play.h.
I tested in Ubuntu18.04 and ROS-Melodic with current master branch and C++.
It only play once. And it can repeat successfully when changed to this one: https://github.com/yann-bourrigault/audio_common
Here is my test code:
#include "ros/ros.h"
#include <sound_play/sound_play.h>
void sleepok(int t, ros::NodeHandle &nh)
{
if (nh.ok())
sleep(t);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "talker");
ros::NodeHandle n;
sound_play::SoundClient sc;
sleepok(1, n);
// sc.startWave ( "/home/zhyx/catkin_ws/src/sound_play/sounds/say-beep.wav", 1.0f ) ;
// sc.start(sound_play::SoundRequest::BACKINGUP);
sound_play::Sound s1 = sc.waveSound("/home/zhyx/catkin_ws/src/sound_play/sounds/say-beep.wav");
s1.repeat();
sleepok(3, n);
return 0;
}
from audio_common.
you don't need to run repeat
in loop, and I tried repeat
outside of loop, and it worked as expected.
can you test my python script in your environment with origin/master
branch?
from audio_common.
I tested your python script, it worked as expected.
But I tried repeat
outside of loop, it only play once. like this:
#!/usr/bin/env python
import rospy
import sys
from sound_play.libsoundplay import SoundClient
def play_repeat():
soundhandle = SoundClient()
rospy.sleep(0.5)
sound_beep = soundhandle.waveSound("say-beep.wav")
sound_beep.repeat()
rospy.loginfo('beep repeat')
rospy.sleep(4)
if __name__ == '__main__':
rospy.init_node('repeat_test')
play_repeat()
sys.exit(0)
By the way, I tested this in VMware Workstation. Does that matter?
from audio_common.
@zhyx490991014 you forgot sound_beep.play()
for the first play.
this is the correct one.
#!/usr/bin/env python
import rospy
import sys
from sound_play.libsoundplay import SoundClient
def play_repeat():
soundhandle = SoundClient()
rospy.sleep(0.5)
sound_beep = soundhandle.waveSound("say-beep.wav")
sound_beep.play()
rospy.loginfo('first beep')
rospy.sleep(3)
sound_beep.repeat()
rospy.loginfo('beep repeat')
rospy.sleep(4)
if __name__ == '__main__':
rospy.init_node('repeat_test')
play_repeat()
sys.exit(0)
from audio_common.
I tried your script, but it just play once when 'first beep', and another once when 'beep repeat'....
from audio_common.
oh, thanks, I misunderstood about repeat
method.
now I got your point.
from audio_common.
@zhyx490991014 thank you for debugging! I merged #131 to master branch, so this issue may be solved in master branch, too.
from audio_common.
this issue is solved by #131
from audio_common.
Good! Thank you for helping my PR check :)
from audio_common.
Related Issues (20)
- memory leak in audio_play HOT 4
- Parameter name error HOT 3
- Convert rclcpp nodes into components HOT 2
- Make all nodes to nodelet
- AudioData 8 bit integer
- Release AudioDataStamped in noetic HOT 2
- Can we play sound in systemd service + no login?
- Backporting plugin feature to ROS2 branch
- Can't get ROS 2 branch to work in ROS2 humble HOT 25
- Importing the sound_play module is slow HOT 1
- sound_play command not being executed in a docker environment HOT 1
- ros2 branch is not compiling for ROS 2 Humble HOT 4
- ROS2 foxy: Problem when writing to wav file. HOT 2
- ros2 branch has ros1 headers HOT 6
- Question/Tutorial : how to effectively use audio_capture_node in ROS2 HOT 3
- ROS2 Branch: SoundClient blocking mode does not work HOT 4
- Add audio common ros2 branch to `iron` distribution HOT 2
- Replacing `GObject` with `GLib` due to deprecation of `threads_init()` and `GObject.MainLoop`
- Can't cancel loop sounds via action
- How can i play an incoming AudioMessage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audio_common.