From 3c0469c0fcecc927a0ea9a23e256740e814303f5 Mon Sep 17 00:00:00 2001 From: larsimmisch Date: Fri, 18 Dec 2009 22:18:47 +0000 Subject: [PATCH] Do a setperiodsize. git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@37 ec2f30ec-7544-0410-870e-f70ca00c83f0 --- playwav.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playwav.py b/playwav.py index 218c7c2..bbec930 100755 --- a/playwav.py +++ b/playwav.py @@ -4,8 +4,7 @@ # Footnote: I'd normally use print instead of sys.std(out|err).write, -# but we're in the middle of the conversion between python 2 and 3 -# and this code runs on both versions without conversion +# but this version runs on python 2 and python 3 without conversion import sys import wave @@ -21,8 +20,7 @@ def play(device, f): device.setchannels(f.getnchannels()) device.setrate(f.getframerate()) - - # We 8bit is unsigned in wav files + # 8bit is unsigned in wav files if f.getsampwidth() == 1: device.setformat(alsaaudio.PCM_FORMAT_U8) # Otherwise we assume signed data, little endian @@ -34,6 +32,8 @@ def play(device, f): device.setformat(alsaaudio.PCM_FORMAT_S32_LE) else: raise ValueError('Unsupported format') + + device.setperiodsize(320) data = f.readframes(320) while data: