[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Why does pygame.sndarray.make_sound seemingly quadruple the sound duration?
Could it be that a is an array of 64bit floats and each array element
becomes 4 16-bit samples?
On Mon, May 21, 2012 at 12:54 PM, Mike Lawrence <mike.lwrnc@xxxxxxxxx> wrote:
> The following code:
>
> import pygame, numpy
> pygame.mixer.pre_init(frequency=96000,size=-16,channels=1)
> pygame.init()
> a = numpy.random.randn(96000)
> sound = pygame.sndarray.make_sound(a)
> print sound.get_length()
>
> yields a print-out of 4.0, suggesting that the specified duration of
> 96000 samples at a 96000kHz sampling rate was somehow quadrupled
> somewhere along the way. Any idea what I'm missing here? Or is this a
> bug?