3 from vorbisfile
import *
5 adev
= ossaudiodev
.open('w')
6 adev
.setfmt(ossaudiodev
.AFMT_S16_BE
)
11 vf
.open('/home/jack/test.ogg')
14 data
, cs
= vf
.read(8192, format
=FORMAT_FLOAT
)
17 for j
in range(len(data
[0])):
18 l
= int(data
[0][j
]*32768)
19 r
= int(data
[1][j
]*32768)
20 if l
> 32767: l
= 32767
21 if r
> 32767: r
= 32767
22 if l
< -32768: l
= -32768
23 if r
< -32768: r
= -32768
24 buffer += struct
.pack("hh", l
, r
)
27 data
, cs
= vf
.read(8192, format
=FORMAT_FLOAT
)