[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] playing a pure tone from Numeric array
hi
do you know this?
http://www.speech.kth.se/snack/
I am not sure what you are doing but it might interest you anyway.
b
On 6 Aug 2003 at 16:12, John Hunter wrote:
> >>>>> "John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:
>
> John> I am trying to use pygame to create sound arrays with
> John> Numeric. When I try and play the sound, no sound comes out.
> John> Here is what I am doing:
>
> OK, me = moron. The problem was that in casting a floating point
> array which ranged from -1 to 1 to Int16, I ended up with a whole lot
> of zeros. The sound was playing, only the amplitude was a constant
> zero. This works:
>
> from Numeric import *
> from pygame import mixer, sndarray, time
>
> mixer.init(22050, 16, 0)
>
> phi = arange(44100) / 4.0
> s = 32767*sin(phi)
> snd = sndarray.make_sound(s.astype(Int16))
> snd.play()
>
> while mixer.get_busy():
> time.wait(200)
>