en
Sep 2008
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

Last Played

» Ben Kweller – Living Life
» The Smashing Pumpkins – The Tale of Dusty and Pistol Pete
» Belle and Sebastian – The Fox in the Snow
» The Beatles – Michelle
» THE DO – Coda
» Radiohead – Blow Out (live)
» Radiohead – Fake Plastic Trees
» Kasabian – British_legion
» Archive – Sane
» Modest Mouse – Doin' the Cockroach

ALSA Pythonized

In ResPyre project context, Regis Prevot wrote a python binding for ALSA. Because I believe his work could be usefull for other developpers, here is a first version of alsamodule.

This first version supports ALSA mixer. You can get, change, mute, unmute volume on audio channels. Here is a little example:

>>> import alsa
>>> mixer = alsa.mixer("default")
>>> mixer.printInfo()
            **********************
Card Id:                        default
Mixer Card Name:                Intel 82801DB-ICH4
Mixer Device Name:              SigmaTel STAC9750/51,0x42434d64 BCM
Max Volume:                     -1
Min Volume:                     -1
Incremental value min:          -1.00
Number of Elements:             22
            **********************
>>> print mixer.channels.keys()
['Capture', 'Mic', 'Mono Output Select', 'Mix', 
 'Master', 'PCM', 'Aux', 'External Amplifier', 
 '3D Control - Switch', 'Phone', 'PC Speaker', 
 'Line', 'Mic Select', 'CD', '3D Control - Depth', 
 'Master Mono', 'Mix Mono', 'Mic Boost (+20dB)', 
 'Headphone', 'Video', '3D Control - Center', 
 'PCM Out Path & Mute']
>>> print "get volume for device PCM"
get volume for device PCM
>>> print mixer.getVolume("PCM")
(45, 45)
>>> print mixer.setVolume("PCM", 3, 3)
(48, 48)

The binding is written in C, and has been tested under Linux. A setup.py file should come shortly. Until then use the Makefile to build the thing.

Any feedback is welcome.

by Philippe Normand on Wed May 5 21:32:49 2004 (Viewed: 4975 / 0 comments )
  |   RSS  |   RSS2  |   Atom  |   Source  |   Edit
Comments not allowed anymore on this post