[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] sndarray tutorial?
I would like to write a simple application to produce single tones, chirps,
and simple oscillating audio. After tooling around on pygame.org, I decided
that the best way to do this was probably to generate appropriate numeric
values and use them to initialize a call to pygame.sndarray.make_sound(). I
can't seem to get it to work at all, though.
I'm new to pygame and may be missing something, but I've google'd for sndarray
in every permutation I could think of, and haven't been able to find any kind
of tutorial or example document or howto. None of the projects linked from
pygame.org seem to use it, and I didn't really understand the source when I
tried to read it. So I decided to write the list for help.
Do any how-to style documents exist for sndarray? What does make_sound
require from the Numeric array? e.g., how should it be formatted and typed
and so forth?
I was quite surprised when I did this in the python interpreter:
>>> a = sndarray.array(mixer.Sound('/usr/share/licq/sounds/Monty-Python.wav'))
>>> s = sndarray.make_sound(a)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: Invalid array datatype for sound
I would have thought that pygame.sndarray.array would return an array useful
to sndarray.make_sound; this has me pretty bewildered.
Any pointers or sample code anyone can provide would be very helpful.
pygame mailing list