en
Mar 2010
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 31

Last Played

» Bandes Originales de Films – Synchronised Instant
» Bandes Originales de Films – Let Them Try (inst.)
» Bandes Originales de Films – Spaghetti Del Mare
» Bandes Originales de Films – Remembering A Heart Beat
» Bandes Originales de Films – Between The sky-Scrapers
» Bandes Originales de Films – Water Works
» Bandes Originales de Films – Huacracocha
» Bandes Originales de Films – La Raya
» Bandes Originales de Films – Rescue In A Wreck
» Bandes Originales de Films – Sailing To Death

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: 6404 / 0 comments )
  |   RSS  |   RSS2  |   Atom  |   Source  |   Edit
Comments not allowed anymore on this post