[Tutor] how to play arrays as audio signal

Hans Fangohr H.FANGOHR at soton.ac.uk
Tue Oct 19 11:32:02 CEST 2004


Greetings,

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.)

Here is an example:


import numarray

freq=110 #frequency in Hertz

samplerate = 1000 #Hertz

x=numarray.arange(0,1,1.0/samplerate)
y=numarray.sin(x*2*numarray.pi*freq)


What is missing, is something along the following lines:

import sound?
sound?.playvector( y, samplerate )


Looking forward to hearing any suggestions,

Hans


More information about the Tutor mailing list