[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] pygame.sndarray.array = ValueError: string size must be a multiple of element size
- To: pygame-users@xxxxxxxx
- Subject: [pygame] pygame.sndarray.array = ValueError: string size must be a multiple of element size
- From: B W <stabbingfinger@xxxxxxxxx>
- Date: Tue, 3 Aug 2010 11:03:48 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 03 Aug 2010 14:04:00 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=PoMzWgdBMgZuoZYX5VqQQUYULLkqluGzIISvQg2ueg4=; b=qVqJkLq+kRH5GX9ZynRBt7AEL/Cg52Zm/Xy2eJ95s82nVwuoVY6Bgq1M7Hof7WFbWk NZwOc2o+oKHHEMGqmwNOGZHOS0ysIMYsFlQl38VqSqRKHrIYvfH1u8MUqFdNyQKFeaYY 8/hrSZMoUgUElZTjpYcgJSIumm3a0UMpTmLN8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=mBbEjhAddIhhHPKuAYSJov0+zZH0HKyJRdJBUBAw3t+IdTnNPdLMFq6Qi7NuHSpJoB 7cABchruUM+JgfLWlIk2E1w1UFypICF7omI9F6W7fA6e195NHhsQSGZsef71eBEzaz3Z MW1xBV+AEwkPsDw6lb3M22H9NhRVt9day7NJU=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Howdy, folks.
Seeking enlightenment. Anyone seen this before, and how do I rassle it into submission? Docs and web have been unhelpful so far. I'm using pre-built software packages; been using these for months without any issues.
This problem occurs with all ogg and wav files. I see that Numpy is raising the
exception, but I can't tell if it's a problem internal to Numpy or a
result of how numpysnd.array is using Numpy.
Summary:
1. load OGG-Vorbis sound file with pygame.mixer.Sound
2. convert sound using pygame.sndarray.array
3. scratch head
<CODE>
import os, sys, numpy, pygame
from pygame.locals import *
pygame.init()
pygame.mixer.init(44100, 16, 2, 1)
sound = pygame.mixer.Sound('../sounds/laser_26667.ogg')
for n,v in [('OS',os.name),('Python',sys.version),('Pygame',pygame.version.vernum),
('Numpy',numpy.version.version),('Array type',pygame.sndarray.get_arraytype())]:
print '%s: %s' % (n,v)
sound_data = pygame.sndarray.array(sound)
</CODE>
C:/Python26/pythonw.exe -u "C:/cygwin/home/Gumm/devel/python/project/gummball/blah.py"
OS: nt
Python: 2.6.5 (r265:79063, Mar 20 2010, 14:22:52) [MSC v.1500 32 bit (Intel)]
Pygame: (1, 9, 1)
Numpy: 1.4.1
Array type: numpy
Traceback (most recent call last):
File "C:/cygwin/home/Gumm/devel/python/project/gummball/blah.py", line 9, in <module>
sound_data = pygame.sndarray.array(sound)
File "C:\Python26\Lib\site-packages\pygame\sndarray.py", line 95, in array
return numpysnd.array (sound)
File "C:\Python26\Lib\site-packages\pygame\_numpysndarray.py", line 77, in array
return _array_samples(sound, True)
File "C:\Python26\Lib\site-packages\pygame\_numpysndarray.py", line 64, in _array_samples
array = numpy.fromstring (data, typecode)
ValueError: string size must be a multiple of element size
Any assistance appreciated.
Gumm