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.

  1. generate tone @ given frequency tone generator, .wav file. put .wav file @ accessible path.

  2. 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() 
  3. to adjust volume, call:

    mysound.setvolume(0.5) # 0.0~1.0  

this solution works perfectly. panda3d.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -