• Home
  • History
  • Annotate
  • current directory
Name Date Size #Lines LOC

..16-Aug-2019-

debian/H24-Jul-2003-

src/H16-Aug-2019-

AUTHORSH A D06-Oct-200241 21

COPYINGH A D06-Oct-200217.6 KiB341281

ChangeLogH A D24-Jul-20032.2 KiB6142

PKG-INFOH A D24-Jul-2003253 1110

READMEH A D06-Oct-20022 KiB6244

config_unix.pyH A D06-Oct-20023 KiB132101

prebuild.shH A D06-Oct-200232 31

setup.cfgH A D12-Oct-200252 43

setup.pyH A D24-Jul-20031.5 KiB5942

test.pyH A D06-Oct-2002156 105

README

1pyao - a Python wrapper module for the ao library
2
3This is a wrapper for libao, an audio device abstraction
4library. libao is available with ogg/vorbis at http://www.xiph.org.
5
6To build you need distutils package from
7http://www.python.org/sigs/distutils-sig/download.html (it comes with
8Python 2.0). To install:
9
10python config_unix.py
11python setup.py build
12[as root] python setup.py install
13
14Use the config_unix.py script to configure the build first. You can
15pass a --prefix argument to tell the script where you have the ao
16files installed. If you have problems, check the file config.log for
17specifics. If you have any problems let me know. Access the module by
18using "import ao" in your Python code.
19
20Here's an interactive session of just playing with the module, until I
21create better documentation (there should be docstrings for
22everything). Watch as I read some random data and "play" it to a wave
23file.
24
25>>> import ao
26
27>>> dev = ao.AudioDevice('wav', filename = 'myoutput.wav')
28
29>>> f = open('/dev/urandom', 'r') #that's some good stuff
30
31>>> print dev
32<AudioDevice object at 0x812ac28>
33
34>>> print dev.driver_info()
35{'author': 'Aaron Holtzman <aholtzma@ess.engr.uvic.ca>',
36 'short_name': 'wav',
37 'name': 'WAV file output',
38 'comment': 'Sends output to a .wav file'}
39
40>>> print ao.driver_info('oss')
41{'author': 'Aaron Holtzman <aholtzma@ess.engr.uvic.ca>',
42 'short_name': 'oss',
43 'name': 'OSS audio driver output ',
44 'comment': 'Outputs audio to the Open Sound System driver.'}
45
46>>> data = f.read(1024*8)
47
48>>> dev.play(data)
49
50>>> <control-d>
51
52And now I have a file myoutput.wav with random noise in it.
53
54A note: Because of the way the AO API works, if you are opening a
55device that outputs to a file (like raw or wav), then you HAVE to pass
56the filename as a keyword parameter to the constructor (like
57above). It can't just be an option (you used to be able to do
58that). Opening a "live" device (e.g. oss or alsa), you obviously don't
59have to worry about the filename.
60
61
62Andrew Chatham <andrew.chatham@duke.edu>