ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH

Reference
ActivePython 2.5
Python Documentation
Library Reference
19. Multimedia Services
19.1 audioop -- Manipulate raw audio data
19.2 imageop -- Manipulate raw image data
19.3 aifc -- Read and write AIFF and AIFC files
19.4 sunau -- Read and write Sun AU files
19.5 wave -- Read and write WAV files
19.6 chunk -- Read IFF chunked data
19.7 colorsys -- Conversions between color systems
19.8 rgbimg -- Read and write ``SGI RGB'' files
19.9 imghdr -- Determine the type of an image
19.10 sndhdr -- Determine type of sound file
19.11 ossaudiodev -- Access to OSS-compatible audio devices
19.11.1 Audio Device Objects
19.11.2 Mixer Device Objects

MyASPN >> Reference >> ActivePython 2.5 >> Python Documentation >> Library Reference >> 19. Multimedia Services
ActivePython 2.5 documentation

19.11 ossaudiodev -- Access to OSS-compatible audio devices

Availability: Linux, FreeBSD.

New in version 2.3.

This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and commercial Unices, and is the standard audio interface for Linux and recent versions of FreeBSD.

See Also:

Open Sound System Programmer's Guide
the official documentation for the OSS C API

The module defines a large number of constants supplied by the OSS device driver; see <sys/soundcard.h> on either Linux or FreeBSD for a listing .

ossaudiodev defines the following variables and functions:

exception OSSAudioError
This exception is raised on certain errors. The argument is a string describing what went wrong.

(If ossaudiodev receives an error from a system call such as open(), write(), or ioctl(), it raises IOError. Errors detected directly by ossaudiodev result in OSSAudioError.)

(For backwards compatibility, the exception class is also available as ossaudiodev.error.)

open( [device, ]mode)
Open an audio device and return an OSS audio device object. This object supports many file-like methods, such as read(), write(), and fileno() (although there are subtle differences between conventional Unix read/write semantics and those of OSS audio devices). It also supports a number of audio-specific methods; see below for the complete list of methods.

device is the audio device filename to use. If it is not specified, this module first looks in the environment variable AUDIODEV for a device to use. If not found, it falls back to /dev/dsp.

mode is one of 'r' for read-only (record) access, 'w' for write-only (playback) access and 'rw' for both. Since many sound cards only allow one process to have the recorder or player open at a time, it is a good idea to open the device only for the activity needed. Further, some sound cards are half-duplex: they can be opened for reading or writing, but not both at once.

Note the unusual calling syntax: the first argument is optional, and the second is required. This is a historical artifact for compatibility with the older linuxaudiodev module which ossaudiodev supersedes.

openmixer( [device])
Open a mixer device and return an OSS mixer device object. device is the mixer device filename to use. If it is not specified, this module first looks in the environment variable MIXERDEV for a device to use. If not found, it falls back to /dev/mixer.



See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved