1

pygame.mixer and pygame.mixer.music are limited. We can expand and play anything using pygame.sndarray, and in newer versions of pygame it is possible to use pygame.mixer.Sound() directly on numpy arrays.

But I don't want either numpy nor numeric to be packaged inside my application executable. I do not need it for anything except that and importing it slows down application startup.

I am wandering whether some hack can be made to emulate numpy.ndarray() so that pygame.mixer.Sound() will accept it as valid data. I.e. I am sure that this can work and I am working on it.

I tried using array.array() and pygame.mixer.Sound() accepts it neatly, but when this Sound() is played it shows all signs of activity, but no sound comes out of speakers. get_busy() says that sound is playing, no errors are raised, but no music is played also.

It also may be possible to push the data directly into pygame.mixer.Sound()'s data buffer, but I do not yet know how it is called etc. etc.

It is always a bit problematic to fool these C+Python mixtures without heavy digging through source code. :D

Any idea is appreciated. It will help speeding up development.

Dalen
  • 4,128
  • 1
  • 17
  • 35

0 Answers0