Python的声音开发包 pySoundic
fmms
13年前
<p>pySonic 是封装了高性能、跨平台的FMOD声音库 Python 开发包。</p> <ul> <li>Device and output initialization</li> <li>Runtime updating and information</li> <li>File and memory samples</li> <li>File, memory, and web streams</li> <li>3D sound</li> <li>EAX global and channel reverb</li> <li>Sample and stream playback (wav, aiff, mp3, ogg, etc.)</li> <li>Music playback (midi, mod, s3m, it, xm, etc.)</li> <li>Sound recording</li> </ul> <p><img alt="Python的声音开发包 pySoundic" src="https://simg.open-open.com/show/a5b4b50ec6bfa051a76958690ab766fc.png" width="520" height="200" /></p> <p>示例代码:</p> <pre class="brush:python; toolbar: true; auto-links: false;"> 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)</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326272802171" target="_blank">http://www.open-open.com/lib/view/home/1326272802171</a></p> <p></p>