[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Sound to Light



Pygame has no function for this. You need to perform a Fourier transform on the sample data. Python will certainly be too slow to do this in real time, but Numeric and friends have fast Fourier transform (FFT) functions that would do nicely (Numeric.FFT, numpy.dft). You'll want to do the transform in a mixer post-effect callback. You can't hook this callback in Pygame, but Pygame-ctypes provides it (via SDL-ctypes using Mix_RegisterEffect).

Alex.

Chris Ashurst wrote:

I was wondering if the mixer class in PyGame has any sort of ability to
read/determine the frequency currently passing through it (I'm having vague
ideas about some sort of sound-to-light/equalizer thing going around in my
head).

I'm kind of 90% certain that the answer is no, but I figured PyGame would be
the best place to ask about it.

*If* the answer is no, then would it be because Python isn't fast enough for
that processing?

Hope someone can point me in any kind of Python-direction on this :)


~Chris




CONFIDENTIAL NOTICE: This email including any attachments, contains confidential information belonging to the sender. It may also be privileged or otherwise protected by work product immunity or other legal rules. This information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this emailed information is strictly prohibited. If you have received this email in error, please immediately notify us by reply email of the error and then delete this email immediately.