Audioop: How do I load info into it?

Fredrik Lundh effbot at telia.com
Sun Oct 8 06:58:53 EDT 2000


Joal wrote:
> Okay, I'll be short and sweet. The documentation says that audioop takes
> audio data in signed integer samples. How do I create these signed
> integer samples? Either a pointer to the documentation

http://www.python.org/doc/current/lib/module-array.html

> or a piece of example code would be great.

noise = []
for i in range(8000):
    noise.append(whrandom.randint(-32767, 32767))
data = array.array("h", noise).tostring()

</F>




More information about the Python-list mailing list