You can clone with
HTTPS or Subversion.
Just trying to play a wav file.
This is Linux and I can't find a wav sample that it's OK for AVBin. Some of them crash with "division by zero" and others doesn't seem to play correctly.
I can provide wav samples.
Traceback (most recent call last):
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/resource.py", line 610, in media
return media.load(path, streaming=streaming)
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/media/__init__.py", line 1408, in load
source = StaticSource(source)
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/media/__init__.py", line 612, in __init__
audio_data = source.get_audio_data(buffer_size)
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/media/avbin.py", line 428, in get_audio_data
packet_type, packet = self._process_packet()
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/media/avbin.py", line 399, in _process_packet
audio_data = self._decode_audio_packet()
File "/home/reidrac/src/shooter/X/lib/python2.7/site-packages/pyglet/media/avbin.py", line 491, in _decode_audio_packet
duration = float(len(buffer)) / self.audio_format.bytes_per_second
ZeroDivisionError: float division by zero
That's odd for several reasons, not the least of which I didn't think pyglet used AVbin for .wav files (it can play them without AVbin installed).
Could you send me a copy of the sound file, by chance? I haven't been able to reproduce this error on my own.
I've sent you a wav sample.
File Size: 2.91k Bit Rate: 180k
Encoding: Unsigned PCM
Channels: 1 @ 8-bit
You're right, that should be played by pyglet because it is plain PCM.
Great, I'll see if I can figure out what's wrong. Just because pyglet has the ability to play wav files natively doesn't mean it shouldn't work through AVbin.
Don't hold your breath, though. I do this in my (increasingly rare) spare time!
Ah, the problem is in AudioFormat. sample_rate is zero. Oh, dear.
Edit: oh, sent the comment in draft state.
I can't tell, but looks like it. It's failing to read the info from the wav I think.
Anyway, feel free to close the bug.
I was working on a different issue and just put out version 11-alpha1. Would you mind trying it out and letting me know if it happens to make a difference on this issue as well?
It's on the Downloads page temporarily: https://github.com/AVbin/AVbin/downloads
It makes no difference. Same "ZeroDivisionError: float division by zero" sample palce.
Issue #48, #49: Found and fixed bug where all 8-bit audio files repor…
…ted sample rates of 0.
Bumping to alpha 4 so I can release versions for reporters of issue #48…
… and #49 to test.
It should be fixed! I found a line that was (erroneously) overwriting the sample rate information if the audio file was 8-bit. Try version 11-alpha4.
Using 11-alpha 4 on Mac OS X (10.7.5) and (after fixing the file permissions on the libraries) pyglet starts to play this mp3 file: http://incompetech.com/music/royalty-free/mp3-royaltyfree/Pamgaea.mp3 but after about 30 seconds, it just stops.
import pyglet as p
music = p.resource.media('data/music/pamgaea.mp3')
Do you think this is an avbin problem?
Stable version 10 did not work at all - I got the ZeroDivisionError.
I think it's very likely an AVbin problem. I'm pretty much done trying to fix it, though. See https://groups.google.com/forum/#!topic/pyglet-users/HxJVKUPcwgE