当前位置: 首页>>代码示例>>Python>>正文


Python SoundClient.playWaveFromPkg方法代码示例

本文整理汇总了Python中sound_play.libsoundplay.SoundClient.playWaveFromPkg方法的典型用法代码示例。如果您正苦于以下问题:Python SoundClient.playWaveFromPkg方法的具体用法?Python SoundClient.playWaveFromPkg怎么用?Python SoundClient.playWaveFromPkg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sound_play.libsoundplay.SoundClient的用法示例。


在下文中一共展示了SoundClient.playWaveFromPkg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: len

# 需要导入模块: from sound_play.libsoundplay import SoundClient [as 别名]
# 或者: from sound_play.libsoundplay.SoundClient import playWaveFromPkg [as 别名]
#*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#*  POSSIBILITY OF SUCH DAMAGE.
#***********************************************************

# Author: Matthias Nieuwenhuisen, Blaise Gassend


import sys

if __name__ == '__main__':
    if len(sys.argv) < 3 or len(sys.argv) > 4 or sys.argv[1] == '--help':
        print 'Usage: %s package sound_to_play.(ogg|wav) [volume]'%sys.argv[0]
        print
        print 'Plays an .OGG or .WAV file. The path to the file should be relative to the package, and be valid on the computer on which sound_play is running. \n The (optional) volume parameter sets the volume for the sound as a value between 0 and 1.0, where 0 is mute.'
        exit(1)
    
    # Import after printing usage for speed.
    import rospy
    from sound_play.msg import SoundRequest
    from sound_play.libsoundplay import SoundClient

    rospy.init_node('play', anonymous = True)
    soundhandle = SoundClient()

    volume = float(sys.argv[3]) if len(sys.argv) == 4 else 1.0
    
    rospy.sleep(1)
    print 'Playing "%s" from pkg "%s".'%(sys.argv[2], sys.argv[1])
    soundhandle.playWaveFromPkg(sys.argv[1], sys.argv[2], volume)
    rospy.sleep(1)
开发者ID:78226415,项目名称:audio_common,代码行数:32,代码来源:playpackage.py

示例2: TORT

# 需要导入模块: from sound_play.libsoundplay import SoundClient [as 别名]
# 或者: from sound_play.libsoundplay.SoundClient import playWaveFromPkg [as 别名]
#*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
#*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#*  POSSIBILITY OF SUCH DAMAGE.
#***********************************************************

# Author: Matthias Nieuwenhuisen, Blaise Gassend


import sys

if __name__ == '__main__':
    if len(sys.argv) != 3 or sys.argv[1] == '--help':
        print 'Usage: %s package sound_to_play.(ogg|wav)'%sys.argv[0]
        print
        print 'Plays an .OGG or .WAV file. The path to the file should be relative to the package, and be valid on the computer on which sound_play is running.'
        exit(1)
    
    # Import after printing usage for speed.
    import rospy
    from sound_play.msg import SoundRequest
    from sound_play.libsoundplay import SoundClient

    rospy.init_node('play', anonymous = True)
    soundhandle = SoundClient()
    
    rospy.sleep(1)
    print 'Playing "%s" from pkg "%s".'%(sys.argv[2], sys.argv[1])
    soundhandle.playWaveFromPkg(sys.argv[1], sys.argv[2])
    rospy.sleep(1)
开发者ID:BennyRe,项目名称:audio_common,代码行数:32,代码来源:playpackage.py


注:本文中的sound_play.libsoundplay.SoundClient.playWaveFromPkg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。