[Tutor] how to play arrays as audio signal

Kent Johnson kent_johnson at skillsoft.com
Fri Oct 22 02:23:00 CEST 2004


The wav module might help. You would have to learn enough about the wav 
format to write your data into a wav file. Then you can play it with winsound.

Kent

At 10:32 AM 10/19/2004 +0100, Hans Fangohr wrote:
>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
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list