[Tutor] how to play arrays as audio signal
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Wed Oct 20 03:36:15 CEST 2004
On Tue, 19 Oct 2004, Hans Fangohr wrote:
> I would like to 'acoustically play' values in an array (or list, tupel,
> ...) as if the position of the speaker membrane at different times was
> given by the value in that array. Is there a module (in the best case a
> standard module) that would do this for me? (I will need this on
> Windows.)
Hi Hans,
Your best bet is probably the pygame module:
http://pygame.org/
In fact:
http://pygame.org/docs/ref/pygame_sndarray.html
uses Numeric Python arrays to generate sounds.
http://archives.seul.org/pygame/users/Nov-2002/msg00120.html
shows sample code to play a sound out of a Numeric Python array.
However, PyGame has not have adopted 'numarray' yet: it looks like they're
still using the older Numeric Python 'numpy' library.
The switch to 'numarray' appears to be a TODO for the PyGame folks:
http://www.pygame.org/readme.html
Until then, it might be easiest to use Numeric Python's arrays with
PyGame.
Good luck to you!
More information about the Tutor
mailing list