Code Monkey home page Code Monkey logo

Comments (15)

zhyx490991014 avatar zhyx490991014 commented on July 20, 2024 2

thank you! it worked as expected in master branch

from audio_common.

nickvaras avatar nickvaras commented on July 20, 2024 1

This bug is still present on deb package.

from audio_common.

heuristicus avatar heuristicus commented on July 20, 2024

Can confirm this. I'm also running 14.04 with indigo.

from audio_common.

zhyx490991014 avatar zhyx490991014 commented on July 20, 2024

The latest version seems still has bugs, but this one works: https://github.com/yann-bourrigault/audio_common

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

In my environment with current master branch, I cannot reproduce this issue and I can repeat the wave play multiple times.

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

@zhyx490991014

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.

zhyx490991014 avatar zhyx490991014 commented on July 20, 2024

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.

knorth55 avatar knorth55 commented on July 20, 2024

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.

zhyx490991014 avatar zhyx490991014 commented on July 20, 2024

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.

knorth55 avatar knorth55 commented on July 20, 2024

@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.

zhyx490991014 avatar zhyx490991014 commented on July 20, 2024

I tried your script, but it just play once when 'first beep', and another once when 'beep repeat'....

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

oh, thanks, I misunderstood about repeat method.
now I got your point.

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

@zhyx490991014 thank you for debugging! I merged #131 to master branch, so this issue may be solved in master branch, too.

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

this issue is solved by #131

from audio_common.

knorth55 avatar knorth55 commented on July 20, 2024

Good! Thank you for helping my PR check :)

from audio_common.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.