微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pySoundic Python的声音开发包

程序名称:pySoundic

授权协议: MIT

操作系统: Windows

开发语言: Python

pySoundic 介绍

pySonic 是封装了高性能、跨平台的FMOD声音库 Python 开发包。

示例代码

     import pySonic
      import time

      def finished_stream(source):
        print 'Stream finished playing'

      # initialize the audio environment
      w = pySonic.World()

      # create two sources
      src1 = pySonic.source()
      src2 = pySonic.source()

      # load a sound entirely from disk, stream another from disk
      src1.sound = pySonic.FileSample('short.wav')
      src2.sound = pySonic.FileStream('long.mp3')

      # position the sources in 3D space
      src1.Position = (-0.5, 0.0, 0.5)
      src2.Position = (0.5, 0.0, 0.5)

      # register a callback for when the stream finishes
      src2.SetEndStreamCallback(finished_stream)

      # register a callback for when the stream finishes
      src1.Play()
      src2.Play()

      # just block while we're playing in this example
      while src1.IsPlaying() or src2.IsPlaying():
        time.sleep(1)

pySoundic 官网

http://pysonic.sourceforge.net/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐