Closed GoogleCodeExporter closed 8 years ago
Can't replicate it here (I have a Creative Audigy 4); I suspect there's a
hardware
limitation on buffer size.
See if you can get past the error (audio will be broken) by changing the value
of
int(self._buffer_time * audio_format.sample_rate)
at pyglet/media/drivers/alsa/__init__.py:97. I imagine the number needs to be
either
smaller, larger, or aligned to some number (for example, a multiple of 4).
If this is the case, we need to find the appropriate ALSA magic that gives the
constraints.
Original comment by Alex.Hol...@gmail.com
on 2 Oct 2007 at 1:02
8192 gets passed it. I get about 4-6 ball bounce sounds before I get the
following trace.
4096 also works but only get 1 bounce.
16384 gives the original trace.
Traceback (most recent call last):
File "noisy.py", line 85, in <module>
ball.update(dt)
File "noisy.py", line 47, in update
sound.play()
File "/home/ajones/dev/pyglet/pyglet/media/__init__.py", line 377, in play
player.queue(self)
File "/home/ajones/dev/pyglet/pyglet/media/__init__.py", line 692, in queue
self._begin_source()
File "/home/ajones/dev/pyglet/pyglet/media/__init__.py", line 775, in _begin_source
self._fill_audio()
File "/home/ajones/dev/pyglet/pyglet/media/__init__.py", line 628, in _fill_audio
self._audio.write(audio_data)
File "/home/ajones/dev/pyglet/pyglet/media/drivers/alsa/__init__.py", line 146, in
write
check(asound.snd_pcm_delay(self.pcm, delay))
File "/home/ajones/dev/pyglet/pyglet/media/drivers/alsa/__init__.py", line 56, in check
raise ALSAException(asound.snd_strerror(err))
pyglet.media.drivers.alsa.ALSAException: Broken pipe
Original comment by andy.lar...@gmail.com
on 2 Oct 2007 at 1:45
Also the value I was getting for int(self._buffer_time *
audio_format.sample_rate)
was 13230
Original comment by andy.lar...@gmail.com
on 2 Oct 2007 at 1:48
This is the error that I was getting too (see
http://groups.google.com/group/pyglet-users/web/sound-under-ubuntu-feisty for
details
on switching to openal). I can have a dig around when I get home tonight and
see if I
can shed more light.
Original comment by anthony....@gmail.com
on 3 Oct 2007 at 12:34
My error is actually on the line above (95), but they may be related. I put the
following debug statements into pyglet/media/drivers/alsa/__init__.py:95:
print "Sample rate is:", audio_format.sample_rate
print asound.snd_pcm_hw_params_set_rate(self.pcm, self.hwparams,
audio_format.sample_rate, 0)
check(asound.snd_pcm_hw_params_set_rate(self.pcm, self.hwparams,
audio_format.sample_rate, 0))
And got the following output:
Sample rate is: 44100
-22
Traceback (most recent call last):
File "./test.py", line 6, in <module>
bullet_sound.play()
File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line 377, in play
player.queue(self)
File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line 692, in queue
self._begin_source()
File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line 774, in
_begin_source
self._create_audio()
File "/usr/lib/python2.5/site-packages/pyglet/media/__init__.py", line 607, in
_create_audio
self._audio = audio_player_class(source.audio_format)
File "/usr/lib/python2.5/site-packages/pyglet/media/drivers/alsa/__init__.py", line
97, in __init__
audio_format.sample_rate, 0))
File "/usr/lib/python2.5/site-packages/pyglet/media/drivers/alsa/__init__.py", line
56, in check
raise ALSAException(asound.snd_strerror(err))
pyglet.media.drivers.alsa.ALSAException: Invalid argument
Other factors:
This is against the latest release (r1308), running on Ubuntu Feisty.
My sound card is also quite old, so your earlier hunch about buffer size may be
right:
00:08.0 Multimedia audio controller: Ensoniq 5880 AudioPCI (rev 02)
Subsystem: Ensoniq Creative SoundBlaster AudioPCI 128
Flags: bus master, slow devsel, latency 64, IRQ 11
I/O ports at e800 [size=64]
Capabilities: [dc] Power Management version 1
Hope that helps track down what's going on -- let me know if you need any more
info.
Original comment by anthony....@gmail.com
on 3 Oct 2007 at 1:27
I've added some commented experimental code to r1309 to address both the buffer
size
and the sample rate problems. Before starting, set an environment variable
PYGLET_DEBUG_MEDIA to 1; this will print some things to stdout as well as
create an
alsa.log file.
Try commenting/uncommenting code in pyglet/media/drivers/alsa/__init__.py around
lines 97 and 122 according to the comments and log what happens.
Apologies for the experimental nature of this... experiment!
Original comment by Alex.Hol...@gmail.com
on 3 Oct 2007 at 3:15
Original issue reported on code.google.com by
andy.lar...@gmail.com
on 2 Oct 2007 at 12:50