audio - How to keep playing a sound at a given frequency and volume in Python? -
i have gui program written python+panda3d. want add sound keeps playing during runtime. frequency of sound constant, , volume determined variable , modified time time.
what's easiest way implement this?
i've searched audio libraries of python, seem complex though desired feature simple. wonder whether there's easier way.
thanks.
update: program windows.
well, there's no available answer yet, let me report own workaround.
generate tone @ given frequency tone generator, .wav file. put .wav file @ accessible path.
use panda3d's built-in sound function:
base = showbase() mysound = base.loader.loadsfx("path/to/the_tone.wav")
make keep playing:
mysound.setloop(true) mysound.play()
to adjust volume, call:
mysound.setvolume(0.5) # 0.0~1.0
this solution works perfectly. panda3d.
Comments
Post a Comment