I am trying to build a little sound generator with pygame and numpy. The following code plays the data out of my numpy arrays correctly, but when I try to use this code in a module and access it either from different threads or from different processes to play two sounds at a time, one of the sounds is played before the other one instead of both at the same time
def _play_array(array, ms, vol):
sound = pygame.sndarray.make_sound(_intern._as_int16(array))
channel = sound.play(-1)
channel.set_volume(vol)
if ms > 50:
pygame.time.delay(ms-50)
channel.fadeout(50)
else:
pygame.time.delay(ms)
sound.stop()
update:
I have tried installing audiere, but all that happens is that it comes up with a ridiculously long error traceback, but this apparently is the problem the installer encountered: /Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
(edit)
Now I found out it does not work on Mac OS X
update 2:
trying to use snack/tkSnack: RuntimeError: Tk not intialized or not registered with Snack
update 3:
trying to install wxPython to play the sound after writing it to a file – import wx just fails: /usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal wrapper. I am getting slightly annoyed by this problem…
update 4:
see post
This has become to annoying for me. I decided to use the os-wide standard music player to play it, as none of the other methods seem to work.
works fine on mac.