From 8fa9d27a8865a10d485fc98b625c6d40a18bdec7 Mon Sep 17 00:00:00 2001 From: larsimmisch Date: Thu, 24 Jan 2008 12:22:41 +0000 Subject: [PATCH] Import from divmod. Added css. Original log message: r1585 | casper | 2005-07-09 23:26:15 +0200 (Sat, 09 Jul 2005) | 3 lines Last checkin before version 0.2 git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@12 ec2f30ec-7544-0410-870e-f70ca00c83f0 --- CHANGES | 8 ++ LICENSE | 54 ++++++++ README | 13 +- TODO | 1 - alsaaudio.c | 2 +- doc/about.html | 98 +++++++------- doc/contents.html | 107 ++++++++------- doc/front.html | 113 ++++++++-------- doc/index.html | 97 +++++++------- doc/mixer-objects.html | 230 ++++++++++++++++---------------- doc/module-alsaaudio.html | 131 ++++++++++--------- doc/node3.html | 107 +++++++-------- doc/node4.html | 111 ++++++++-------- doc/node5.html | 107 +++++++-------- doc/node7.html | 105 +++++++-------- doc/pcm-example.html | 103 ++++++++------- doc/pcm-objects.html | 266 +++++++++++++++++++------------------- doc/pyalsaaudio.css | 243 ++++++++++++++++++++++++++++++++++ doc/pyalsaaudio.html | 97 +++++++------- doc/src/Makefile | 7 +- doc/src/libalsaaudio.tex | 4 +- doc/src/pyalsaaudio.tex | 2 +- playbacktest.py | 4 +- recordtest.py | 2 +- 24 files changed, 1192 insertions(+), 820 deletions(-) create mode 100644 CHANGES create mode 100644 LICENSE create mode 100644 doc/pyalsaaudio.css diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..6ce8463 --- /dev/null +++ b/CHANGES @@ -0,0 +1,8 @@ +VERSION 0.1 +- Initial version + + +VERSION 0.2 +- Many bugfixes related to playback in particular +- Module documentation in the doc subdirectory + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8aa69f7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,54 @@ +PyAlsaAudio is released under the same conditions as Python itself. +The original wording of this license can be found below. + + +PSF LICENSE AGREEMENT FOR PYTHON 2.4 +------------------------------------ + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using Python 2.4 software in source or binary form and its +associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 2.4 +alone or in any derivative version, provided, however, that PSF's +License Agreement and PSF's notice of copyright, i.e., "Copyright (c) +2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved" +are retained in Python 2.4 alone or in any derivative version prepared +by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 2.4 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 2.4. + +4. PSF is making Python 2.4 available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.4 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +2.4 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.4, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python 2.4, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + diff --git a/README b/README index 5276f40..179cb79 100644 --- a/README +++ b/README @@ -24,7 +24,10 @@ Installation Note: the wrappers link with the alsasound library alsa (from the alsa-lib package). Verify that this is installed by looking for /usr/lib/libasound.so -before building. Naturally you also need to use a kernel with proper ALSA +before building. The libasound development files are also neccesary. On debian +and derivatives, this is achieved by installing the alsalib-dev package. + +Naturally you also need to use a kernel with proper ALSA support. This is the default in Linux kernel 2.6 and later. If you are using kernel version 2.4 you may need to install the ALSA patches yourself - although most distributions ship with ALSA kernels. @@ -38,13 +41,15 @@ And then as root: Using the API ============= +There is a reasonably usefull API documentation included in the module +documentation, which can be found in the doc subdirectory of the source +distribution. -There are two example programs included with the source: +There are also three example programs included with the source: 'playbacktest.py' which plays back raw sound data read from stdin 'recordtest.py' which captures sound from the microphone at writes it raw to stdout. -In a future version, I'll include documentation with the package, but -for now, you're stuck with the examples. +'mixertest.py' which can be used to manipulate the mixers diff --git a/TODO b/TODO index 8f8f370..710a8a3 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -- Write documentation - Better example code (aplay,arecord,amixer workalike for example) - Implement MIDI/sequencer support. diff --git a/alsaaudio.c b/alsaaudio.c index 85e3509..1828148 100644 --- a/alsaaudio.c +++ b/alsaaudio.c @@ -373,7 +373,7 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args) { int res; if (!PyArg_ParseTuple(args,"s#",&data,&datalen)) return NULL; if (datalen%self->framesize) { - PyErr_SetString(ALSAAudioError,"Data size must be a multipla of framesize"); + PyErr_SetString(ALSAAudioError,"Data size must be a multiple of framesize"); return NULL; } res = snd_pcm_writei(self->handle, data, datalen/self->framesize); diff --git a/doc/about.html b/doc/about.html index 13c8b28..c47ebca 100644 --- a/doc/about.html +++ b/doc/about.html @@ -1,44 +1,45 @@ - - - - - - - - - - - - + + + + + + + + About this document ... @@ -72,33 +73,36 @@ About this document ...

diff --git a/doc/contents.html b/doc/contents.html index 5809ee9..7f5eb2a 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -1,52 +1,54 @@ - - - - - - - - - - - - - - + + + + + + + + + + Contents -
-

+

Contents -

+

+ diff --git a/doc/mixer-objects.html b/doc/mixer-objects.html index 4790641..5a4d516 100644 --- a/doc/mixer-objects.html +++ b/doc/mixer-objects.html @@ -1,53 +1,55 @@ - - - - - - - - - - - - - - + + + + + + + + + + 4.3 Mixer Objects -

  +

+
4.3 Mixer Objects

@@ -57,8 +59,8 @@ Mixer objects provides access to the ALSA mixer API.

- -
class Mixer([control], [id], [cardname])
+ class Mixer( + [control], [id], [cardname])
control - specifies which control to manipulate using this mixer object. The list of available controls can be found with the alsaaudio.mixers function. @@ -77,16 +79,16 @@ Mixer objects have the following methods:

- -
cardname()
+ cardname( + )
Return the name of the sound card used by this Mixer object

- -
mixer()
+ mixer( + )
Return the name of the specific mixer controlled by this object, For example 'Master' or 'PCM' @@ -94,44 +96,44 @@ or 'PCM'

- -
mixerid()
+ mixerid( + )
Return the ID of the ALSA mixer controlled by this object.

- -
switchcap()
+ switchcap( + )
Returns a list of the switches which are defined by this specific mixer. Possible values in this list are:

- +
- - - + + + - - - - - - - - - - - - - - - -
Switch Description 
SwitchDescription
'Mute'This mixer can be muted
'Joined Mute'This mixer can mute all channels at the same time
'Playback Mute'This mixer can mute the playback output
'Joined Playback Mute'Mute playback for all channels at the same time
'Capture Mute'Mute sound capture
'Joined Capture Mute'Mute sound capture for all channels at a time
'Capture Exclusive'Not quite sure what this is
+ + 'Mute' + This mixer can be muted + 'Joined Mute' + This mixer can mute all channels at the same time + 'Playback Mute' + This mixer can mute the playback output + 'Joined Playback Mute' + Mute playback for all channels at the same time + 'Capture Mute' + Mute sound capture + 'Joined Capture Mute' + Mute sound capture for all channels at a time + 'Capture Exclusive' + Not quite sure what this is +

To manipulate these swithes use the setrec or setmute methods @@ -139,42 +141,42 @@ To manipulate these swithes use the setrec or

- -
volumecap()
+ volumecap( + )
Returns a list of the volume control capabilities of this mixer. Possible values in the list are:

- +
- - - + + + - - - - - - - - - - - - - -
Capability Description 
CapabilityDescription
'Volume'This mixer can control volume
'Joined Volume'This mixer can control volume for all channels at the same time
'Playback Volume'This mixer can manipulate the playback volume
'Joined Playback Volume'Manipulate playback volumne for all channels at the same time
'Capture Volume'Manipulate sound capture volume
'Joined Capture Volume'Manipulate sound capture volume for all channels at a time
+ + 'Volume' + This mixer can control volume + 'Joined Volume' + This mixer can control volume for all channels at the same time + 'Playback Volume' + This mixer can manipulate the playback volume + 'Joined Playback Volume' + Manipulate playback volumne for all channels at the same time + 'Capture Volume' + Manipulate sound capture volume + 'Joined Capture Volume' + Manipulate sound capture volume for all channels at a time +

- -
getvolume([direction])
+ getvolume( + [direction])
Returns a list with the current volume settings for each channel. The list elements are integer percentages. @@ -189,8 +191,8 @@ if the mixer has this capability, otherwise 'capture'

- -
getmute()
+ getmute( + )
Return a list indicating the current mute setting for each channel. 0 means not muted, 1 means muted. @@ -200,8 +202,8 @@ This method will fail if the mixer has no playback switch capabilities.

- -
getrec()
+ getrec( + )
Return a list indicating the current record mute setting for each channel. 0 means not recording, 1 means not recording. @@ -212,8 +214,8 @@ This method will fail if the mixer has no capture switch capabilities.

- -
setvolume(volume,[channel],[direction])
+ setvolume( + volume,[channel],[direction])
Change the current volume settings for this mixer. The volume argument controls the new volume setting as an integer percentage. @@ -230,8 +232,8 @@ if changed. The default is 'playback' if the mixer has this capability, otherwis

- -
setmute(mute, [channel])
+ setmute( + mute, [channel])
Sets the mute flag to a new value. The mute argument is either 0 for not muted, or 1 for muted. @@ -245,8 +247,8 @@ This method will fail if the mixer has no playback mute capabilities

- -
setrec(capture,[channel])
+ setrec( + capture,[channel])
Sets the capture mute flag to a new value. The capture argument is either 0 for no capture, or 1 for capture. @@ -285,37 +287,39 @@ and that which I do understand has come from a painful trial and error process.

diff --git a/doc/module-alsaaudio.html b/doc/module-alsaaudio.html index a9c59c7..c3673ee 100644 --- a/doc/module-alsaaudio.html +++ b/doc/module-alsaaudio.html @@ -1,48 +1,49 @@ - - - - - - - - - - - - - + + + + + + + + + 4 alsaaudio @@ -51,7 +52,7 @@

- +

Availability:

- -
mixers([cardname])
+ mixers( + [cardname])
List the available mixers. The optional cardname specifies which card should be queried (this is only relevant if you have more than one @@ -77,8 +78,8 @@ sound card). Omit to use the default sound card

- -
class PCM([type], [mode], [cardname])
+ class PCM( + [type], [mode], [cardname])
This class is used to represent a PCM device (both playback and capture devices). The arguments are: @@ -90,8 +91,8 @@ if you have more than one sound card). Omit to use the default sound card

- -
class Mixer([control], [id], [cardname])
+ class Mixer( + [control], [id], [cardname])
This class is used to access a specific ALSA mixer. The arguments are: @@ -102,16 +103,17 @@ if you have more than one sound card). Omit to use the default sound card

-

exception ALSAAudioError +
exception ALSAAudioError
Exception raised when an operation fails for a ALSA specific reason. The exception argument is a string describing the reason of the failure. -
+

-


+



+
Subsections @@ -122,39 +124,42 @@ failure.
  • 4.4 ALSA Examples +
  • diff --git a/doc/node3.html b/doc/node3.html index 281c04f..e848a78 100644 --- a/doc/node3.html +++ b/doc/node3.html @@ -1,49 +1,50 @@ - - - - - - - - - - - - - - + + + + + + + + + + 1 What is ALSA @@ -79,37 +80,39 @@ More information about ALSA may be found on the project homepage

    diff --git a/doc/node4.html b/doc/node4.html index fd1f29d..9c6ab01 100644 --- a/doc/node4.html +++ b/doc/node4.html @@ -1,49 +1,50 @@ - - - - - - - - - - - - - - + + + + + + + + + + 2 ALSA and Python @@ -75,37 +76,39 @@ difficult for me to implement it. Volunteers to work on this would be greatly appreciated diff --git a/doc/node5.html b/doc/node5.html index be05218..923ac75 100644 --- a/doc/node5.html +++ b/doc/node5.html @@ -1,49 +1,50 @@ - - - - - - - - - - - - - - + + + + + + + + + + 3 Installation @@ -74,37 +75,39 @@ And then as root:

    diff --git a/doc/node7.html b/doc/node7.html index 21f71e5..f58333a 100644 --- a/doc/node7.html +++ b/doc/node7.html @@ -1,49 +1,50 @@ - - - - - - - - - - - - - - + + + + + + + + + + 4.1 PCM Terminology and Concepts @@ -113,7 +114,7 @@ slower and read or write multiple periods at the same time.

    Period size
    -
    This is the size of each period in Hz. Not bytes, but Hz!. In alsaaudio +
    This is the size of each period in Hz. Not bytes, but Hz!. In alsaaudio the period size is set directly, and it is therefore important to understand the significance of this number. If the period size is configured to for example 32, each write should contain exactly 32 frames of sound data, and each read will return either 32 frames of data or nothing at all. @@ -128,37 +129,39 @@ Once you understand these concepts, you will be ready to actually utilize PCM AP

    diff --git a/doc/pcm-example.html b/doc/pcm-example.html index f0bb276..d458bac 100644 --- a/doc/pcm-example.html +++ b/doc/pcm-example.html @@ -1,52 +1,53 @@ - - - - - - - - - - - - - + + + + + + + + + 4.4 ALSA Examples -

      +


    4.4 ALSA Examples

    @@ -58,37 +59,39 @@ This will change in a future version.

    diff --git a/doc/pcm-objects.html b/doc/pcm-objects.html index 658ba49..3fc5d78 100644 --- a/doc/pcm-objects.html +++ b/doc/pcm-objects.html @@ -1,53 +1,55 @@ - - - - - - - - - - - - - - + + + + + + + + + + 4.2 PCM Objects -

      +

    +
    4.2 PCM Objects

    @@ -63,8 +65,8 @@ constructor takes the following arguments:

    - -
    class PCM([type], [mode], [cardname])
    + class PCM( + [type], [mode], [cardname])

    @@ -102,32 +104,32 @@ PCM objects have the following methods:

    - -
    pcmtype()
    + pcmtype( + )
    Returns the type of PCM object. Either PCM_CAPTURE or PCM_PLAYBACK.

    - -
    pcmmode()
    + pcmmode( + )
    Return the mode of the PCM object. One of PCM_NONBLOCK, PCM_ASYNC, or PCM_NORMAL

    - -
    cardname()
    + cardname( + )
    Return the name of the sound card used by this PCM object.

    - -
    setchannels(nchannels)
    + setchannels( + nchannels)
    Used to set the number of capture or playback channels. Common values are: 1 = mono, 2 = stereo, and 6 = full 6 channel audio. Few sound cards support more than 2 channels @@ -135,8 +137,8 @@ and 6 = full 6 channel audio. Few sound cards support more than 2 channels

    - -
    setrate(rate)
    + setrate( + rate)
    Set the sample rate in Hz for the device. Typical values are 8000 (poor sound), 16000, 44100 (cd quality), and 96000 @@ -144,77 +146,77 @@ and 96000

    - -
    setformat()
    + setformat( + )
    The sound format of the device. Sound format controls how the PCM device interpret data for playback, and how data is encoded in captures.

    The following formats are provided by ALSA: - +
    - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Format Description 
    FormatDescription
    PCM_FORMAT_S8Signed 8 bit samples for each channel
    PCM_FORMAT_U8Signed 8 bit samples for each channel
    PCM_FORMAT_S16_LESigned 16 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_S16_BESigned 16 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_U16_LEUnsigned 16 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_U16_BEUnsigned 16 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_S24_LESigned 24 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_S24_BESigned 24 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_U24_LEUnsigned 24 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_U24_BEUnsigned 24 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_S32_LESigned 32 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_S32_BESigned 32 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_U32_LEUnsigned 32 bit samples for each channel (Little Endian byte order)
    PCM_FORMAT_U32_BEUnsigned 32 bit samples for each channel (Big Endian byte order)
    PCM_FORMAT_FLOAT_LE32 bit samples encoded as float. (Little Endian byte order)
    PCM_FORMAT_FLOAT_BE32 bit samples encoded as float (Big Endian byte order)
    PCM_FORMAT_FLOAT64_LE64 bit samples encoded as float. (Little Endian byte order)
    PCM_FORMAT_FLOAT64_BE64 bit samples encoded as float. (Big Endian byte order)
    PCM_FORMAT_MU_LAWA logarithmic encoding (used by Sun .au files)
    PCM_FORMAT_A_LAWAnother logarithmic encoding
    PCM_FORMAT_IMA_ADPCMa 4:1 compressed format defined by the Interactive Multimedia Association
    PCM_FORMAT_MPEGMPEG encoded audio?
    PCM_FORMAT_GSM9600 constant rate encoding well suitet for speech
    + + PCM_FORMAT_S8 + Signed 8 bit samples for each channel + PCM_FORMAT_U8 + Signed 8 bit samples for each channel + PCM_FORMAT_S16_LE + Signed 16 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_S16_BE + Signed 16 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_U16_LE + Unsigned 16 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_U16_BE + Unsigned 16 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_S24_LE + Signed 24 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_S24_BE + Signed 24 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_U24_LE + Unsigned 24 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_U24_BE + Unsigned 24 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_S32_LE + Signed 32 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_S32_BE + Signed 32 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_U32_LE + Unsigned 32 bit samples for each channel (Little Endian byte order) + PCM_FORMAT_U32_BE + Unsigned 32 bit samples for each channel (Big Endian byte order) + PCM_FORMAT_FLOAT_LE + 32 bit samples encoded as float. (Little Endian byte order) + PCM_FORMAT_FLOAT_BE + 32 bit samples encoded as float (Big Endian byte order) + PCM_FORMAT_FLOAT64_LE + 64 bit samples encoded as float. (Little Endian byte order) + PCM_FORMAT_FLOAT64_BE + 64 bit samples encoded as float. (Big Endian byte order) + PCM_FORMAT_MU_LAW + A logarithmic encoding (used by Sun .au files) + PCM_FORMAT_A_LAW + Another logarithmic encoding + PCM_FORMAT_IMA_ADPCM + a 4:1 compressed format defined by the Interactive Multimedia Association + PCM_FORMAT_MPEG + MPEG encoded audio? + PCM_FORMAT_GSM + 9600 constant rate encoding well suitet for speech +

    - -
    setperiodsize(period)
    + setperiodsize( + period)
    Sets the actual period size in frames. Each write should consist of exactly this number of frames, and each read will return this number of frames (unless the device is in PCM_NONBLOCK mode, in which case @@ -223,11 +225,11 @@ it may return nothing at all)

    - -
    read()
    + read( + )
    In PCM_NORMAL mode, this function blocks until a full period is available, and then returns a -tuple (length,data) where length is the size in bytes of the captured data, and data +tuple (length,data) where length is the size in bytes of the captured data, and data is the captured sound frames as a string. The length of the returned data will be periodsize*framesize bytes. @@ -238,11 +240,11 @@ has become available since the last call to read.

    - -
    write(data)
    + write( + data)
    -Writes (plays) the sound in data. The length of data must be a multiple of the frame size, and -should be exactly the size of a period. If less than 'period size' frames are provided, the actual +Writes (plays) the sound in data. The length of data must be a multiple of the frame size, and +should be exactly the size of a period. If less than 'period size' frames are provided, the actual playout will not happen until more data is written.

    @@ -258,14 +260,14 @@ full. In this case, the data should be written at a later time.

    -A few hints on using PCM devices for playback +A few hints on using PCM devices for playback

    The most common reason for problems with playback of PCM audio, is that the people don't properly understand -that writes to PCM devices must match exactly the data rate of the device. +that writes to PCM devices must match exactly the data rate of the device.

    -If too little data is written to the device will an underrun, and ugly clicking sounds will occur. Conversely, +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero (PCM_NONBLOCK mode). @@ -289,37 +291,39 @@ extra writes as nessecary.

    diff --git a/doc/pyalsaaudio.css b/doc/pyalsaaudio.css new file mode 100644 index 0000000..06a613c --- /dev/null +++ b/doc/pyalsaaudio.css @@ -0,0 +1,243 @@ +/* + * The first part of this is the standard CSS generated by LaTeX2HTML, + * with the "empty" declarations removed. + */ + +/* Century Schoolbook font is very similar to Computer Modern Math: cmmi */ +.math { font-family: "Century Schoolbook", serif; } +.math i { font-family: "Century Schoolbook", serif; + font-weight: bold } +.boldmath { font-family: "Century Schoolbook", serif; + font-weight: bold } + +/* + * Implement both fixed-size and relative sizes. + * + * I think these can be safely removed, as it doesn't appear that + * LaTeX2HTML ever generates these, even though these are carried + * over from the LaTeX2HTML stylesheet. + */ +small.xtiny { font-size : xx-small; } +small.tiny { font-size : x-small; } +small.scriptsize { font-size : smaller; } +small.footnotesize { font-size : small; } +big.xlarge { font-size : large; } +big.xxlarge { font-size : x-large; } +big.huge { font-size : larger; } +big.xhuge { font-size : xx-large; } + +/* + * Document-specific styles come next; + * these are added for the Python documentation. + * + * Note that the size specifications for the H* elements are because + * Netscape on Solaris otherwise doesn't get it right; they all end up + * the normal text size. + */ + +body { color: #000000; + background-color: #ffffff; } + +a:link:active { color: #ff0000; } +a:link:hover { background-color: #bbeeff; } +a:visited:hover { background-color: #bbeeff; } +a:visited { color: #551a8b; } +a:link { color: #0000bb; } + +h1, h2, h3, h4, h5, h6 { font-family: avantgarde, sans-serif; + font-weight: bold; } +h1 { font-size: 180%; } +h2 { font-size: 150%; } +h3, h4 { font-size: 120%; } + +/* These are section titles used in navigation links, so make sure we + * match the section header font here, even it not the weight. + */ +.sectref { font-family: avantgarde, sans-serif; } +/* And the label before the titles in navigation: */ +.navlabel { font-size: 85%; } + + +/* LaTeX2HTML insists on inserting
    elements into headers which + * are marked with \label. This little bit of CSS magic ensures that + * these elements don't cause spurious whitespace to be added. + */ +h1>br, h2>br, h3>br, +h4>br, h5>br, h6>br { display: none; } + +code, tt { font-family: "lucida typewriter", lucidatypewriter, + monospace; } +var { font-family: times, serif; + font-style: italic; + font-weight: normal; } + +.Unix { font-variant: small-caps; } + +.typelabel { font-family: lucida, sans-serif; } + +.navigation td { background-color: #99ccff; + font-weight: bold; + font-family: avantgarde, sans-serif; + font-size: 110%; } + +div.warning { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.warning .label { font-family: sans-serif; + font-size: 110%; + margin-right: 0.5em; } + +div.note { background-color: #fffaf0; + border: thin solid black; + padding: 1em; + margin-left: 2em; + margin-right: 2em; } + +div.note .label { margin-right: 0.5em; + font-family: sans-serif; } + +address { font-size: 80%; } +.release-info { font-style: italic; + font-size: 80%; } + +.titlegraphic { vertical-align: top; } + +.verbatim pre { color: #00008b; + font-family: "lucida typewriter", lucidatypewriter, + monospace; + font-size: 90%; } +.verbatim { margin-left: 2em; } +.verbatim .footer { padding: 0.05in; + font-size: 85%; + background-color: #99ccff; + margin-right: 0.5in; } + +.grammar { background-color: #99ccff; + margin-right: 0.5in; + padding: 0.05in; } +.grammar-footer { padding: 0.05in; + font-size: 85%; } +.grammartoken { font-family: "lucida typewriter", lucidatypewriter, + monospace; } + +.productions { background-color: #bbeeff; } +.productions a:active { color: #ff0000; } +.productions a:link:hover { background-color: #99ccff; } +.productions a:visited:hover { background-color: #99ccff; } +.productions a:visited { color: #551a8b; } +.productions a:link { color: #0000bb; } +.productions table { vertical-align: baseline; + empty-cells: show; } +.productions > table td, +.productions > table th { padding: 2px; } +.productions > table td:first-child, +.productions > table td:last-child { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + } +/* same as the second selector above, but expressed differently for Opera */ +.productions > table td:first-child + td + td { + font-family: "lucida typewriter", + lucidatypewriter, + monospace; + vertical-align: baseline; + } +.productions > table td:first-child + td { + padding-left: 1em; + padding-right: 1em; + } +.productions > table tr { vertical-align: baseline; } + +.email { font-family: avantgarde, sans-serif; } +.mailheader { font-family: avantgarde, sans-serif; } +.mimetype { font-family: avantgarde, sans-serif; } +.newsgroup { font-family: avantgarde, sans-serif; } +.url { font-family: avantgarde, sans-serif; } +.file { font-family: avantgarde, sans-serif; } +.guilabel { font-family: avantgarde, sans-serif; } + +.realtable { border-collapse: collapse; + border-color: black; + border-style: solid; + border-width: 0px 0px 2px 0px; + empty-cells: show; + margin-left: auto; + margin-right: auto; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable tbody { vertical-align: baseline; } +.realtable tfoot { display: table-footer-group; } +.realtable thead { background-color: #99ccff; + border-width: 0px 0px 2px 1px; + display: table-header-group; + font-family: avantgarde, sans-serif; + font-weight: bold; + vertical-align: baseline; + } +.realtable thead :first-child { + border-width: 0px 0px 2px 0px; + } +.realtable thead th { border-width: 0px 0px 2px 1px } +.realtable td, +.realtable th { border-color: black; + border-style: solid; + border-width: 0px 0px 1px 1px; + padding-left: 0.4em; + padding-right: 0.4em; + } +.realtable td:first-child, +.realtable th:first-child { + border-left-width: 0px; + vertical-align: baseline; + } +.center { text-align: center; } +.left { text-align: left; } +.right { text-align: right; } + +.refcount-info { font-style: italic; } +.refcount-info .value { font-weight: bold; + color: #006600; } + +/* + * Some decoration for the "See also:" blocks, in part inspired by some of + * the styling on Lars Marius Garshol's XSA pages. + * (The blue in the navigation bars is #99CCFF.) + */ +.seealso { background-color: #fffaf0; + border: thin solid black; + padding: 0pt 1em 4pt 1em; } + +.seealso > .heading { font-size: 110%; + font-weight: bold; } + +/* + * Class 'availability' is used for module availability statements at + * the top of modules. + */ +.availability .platform { font-weight: bold; } + + +/* + * Additional styles for the distutils package. + */ +.du-command { font-family: monospace; } +.du-option { font-family: avantgarde, sans-serif; } +.du-filevar { font-family: avantgarde, sans-serif; + font-style: italic; } +.du-xxx:before { content: "** "; + font-weight: bold; } +.du-xxx:after { content: " **"; + font-weight: bold; } + + +/* + * Some specialization for printed output. + */ +@media print { + .online-navigation { display: none; } + } diff --git a/doc/pyalsaaudio.html b/doc/pyalsaaudio.html index 558cf0d..fc3e86f 100644 --- a/doc/pyalsaaudio.html +++ b/doc/pyalsaaudio.html @@ -1,55 +1,57 @@ - - - - - - - - - - - + + + + + + + PyAlsaAudio
    -
    +

    PyAlsaAudio

    Casper Wilstrup

    cwi@unispeed.com

    -

    -

    +

    +

    -


    +



    +
    @@ -71,31 +73,36 @@
  • About this document ... +
  • diff --git a/doc/src/Makefile b/doc/src/Makefile index 8187760..44c3313 100644 --- a/doc/src/Makefile +++ b/doc/src/Makefile @@ -5,7 +5,7 @@ # # You also need a working latex installation, and the latex2html # tool installed. -PYTHONSOURCE = /usr/src/Python-2.3.4/ +PYTHONSOURCE = /usr/src/Python-2.4.1/ # Shouldn't need to change anything below here! @@ -13,3 +13,8 @@ MKHOWTO = $(PYTHONSOURCE)/Doc/tools/mkhowto all: $(MKHOWTO) --dir .. --html pyalsaaudio.tex + +text: + $(MKHOWTO) --dir .. --text pyalsaaudio.tex + + diff --git a/doc/src/libalsaaudio.tex b/doc/src/libalsaaudio.tex index 5ac8775..c50ffe5 100644 --- a/doc/src/libalsaaudio.tex +++ b/doc/src/libalsaaudio.tex @@ -234,7 +234,7 @@ full. In this case, the data should be written at a later time. The most common reason for problems with playback of PCM audio, is that the people don't properly understand that writes to PCM devices must match \emph{exactly} the data rate of the device. -If too little data is written to the device will an underrun, and ugly clicking sounds will occur. Conversely, +If too little data is written to the device, it will underrun, and ugly clicking sounds will occur. Conversely, of too much data is written to the device, the write function will either block (PCM_NORMAL mode) or return zero (PCM_NONBLOCK mode). @@ -394,4 +394,4 @@ and that which I do understand has come from a painful trial and error process. \subsection{ALSA Examples \label{pcm-example}} For now, the only examples available are the 'playbacktest.py' and the 'recordtest.py' programs included. -This will change in a future version. \ No newline at end of file +This will change in a future version. diff --git a/doc/src/pyalsaaudio.tex b/doc/src/pyalsaaudio.tex index d8958f1..1a5a4b0 100644 --- a/doc/src/pyalsaaudio.tex +++ b/doc/src/pyalsaaudio.tex @@ -2,7 +2,7 @@ \title{PyAlsaAudio} -\release{0.1} +\release{0.2} % At minimum, give your name and an email address. You can include a % snail-mail address if you like. diff --git a/playbacktest.py b/playbacktest.py index 61218a6..06e0fe9 100644 --- a/playbacktest.py +++ b/playbacktest.py @@ -9,7 +9,9 @@ ## To test it out do the following: ## python recordtest.py > out.raw # talk to the microphone ## python playbacktest.py < out.raw - +## +## If you have Gnome, you could also just test by doing something like: +## python playbacktest.py < /usr/share/sounds/gnibbles/laughter.wav import alsaaudio import sys import time diff --git a/recordtest.py b/recordtest.py index 8a5b9e3..216d627 100644 --- a/recordtest.py +++ b/recordtest.py @@ -33,7 +33,7 @@ inp.setformat(alsaaudio.PCM_FORMAT_S16_LE) # mode. inp.setperiodsize(160) -loops = 10000 +loops = 1000000 while loops > 0: loops -= 1 # Read data from device