booglybob / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

pulse driver fails to play short samples #651

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is Fedora 17 with pulseaudio 1.1 and pyglet from the repository (1.2 
alpha1 +) and avbin 11 (alpha4 I think, although I think it's unrelated).

Pulse driver doesn't play short samples properly, for example:

$ sox --info sample.wav 

Input File     : 'sample.wav'
Channels       : 1
Sample Rate    : 22050
Precision      : 8-bit
Duration       : 00:00:00.13 = 2850 samples ~ 9.69388 CDDA sectors
File Size      : 2.91k
Bit Rate       : 180k
Sample Encoding: 8-bit Unsigned Integer PCM

This wav file is played properly with openal driver.

I'm attaching a wav sample and a test.py.

Original issue reported on code.google.com by useboxnet on 19 May 2013 at 12:55

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by useboxnet on 1 Dec 2013 at 8:50

GoogleCodeExporter commented 8 years ago
Still happening with pulseaudio 3.0.

Original comment by useboxnet on 3 Jan 2014 at 5:26

GoogleCodeExporter commented 8 years ago
I get the following error when trying to play the sample:

Traceback (most recent call last):
  File "/home/larsoner/Desktop/test.py", line 14, in <module>
    audio = pyglet.media.load("sample.wav", streaming=False)
  File "/home/larsoner/custombuilds/pyglet/pyglet/media/__init__.py", line 1453, in load
    source = StaticSource(source)
  File "/home/larsoner/custombuilds/pyglet/pyglet/media/__init__.py", line 618, in __init__
    audio_data = source.get_audio_data(buffer_size)
  File "/home/larsoner/custombuilds/pyglet/pyglet/media/avbin.py", line 427, in get_audio_data
    packet_type, packet = self._process_packet()
  File "/home/larsoner/custombuilds/pyglet/pyglet/media/avbin.py", line 398, in _process_packet
    audio_data = self._decode_audio_packet()
  File "/home/larsoner/custombuilds/pyglet/pyglet/media/avbin.py", line 490, in _decode_audio_packet
    duration = float(len(buffer)) / self.audio_format.bytes_per_second
ZeroDivisionError: float division by zero

Original comment by larson.e...@gmail.com on 22 May 2014 at 5:29

GoogleCodeExporter commented 8 years ago
Can you try AVBin 11 alpha4? https://github.com/AVbin/AVbin/downloads

Original comment by useboxnet on 22 May 2014 at 5:30