[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Screeching, Howling Garbage in One Ear pygame.sndarray



Oh, awesome.  I get it now :D

Thanks, Pete.

On 5/6/06, Peter Shinners <pete@xxxxxxxxxxxx> wrote:
On Sat, 2006-05-06 at 00:21 -0700, andrew baker wrote:
> Cheers, that works a treat, Mr. Shinners.
> That samples[:,0] bit...  I don't think I've ever seen notation like
> that.  I would guess the [: indicates a slice, but then you've a comma
> and THEN the integer.  I'm sorry, but I don't even know what that
> means :S

Here's a quick explanation.

Since the stereo sound array is two dimensional we can index it along
two axis. It may look a little simpler with something like samples[0,0],
which means the first sample of the first channel.

Any regular slice operation can be applied to each axis. So something
like [:,:] would just be the full array. The syntax can get a little
crazy, but it follows some manner of logic.





--
Andrew Ulysses Baker
"failrate"