Skip to content

Instantly share code, notes, and snippets.

@ivanovs-4
Created August 16, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanovs-4/9a4c91cfd2c91426ed6b8d7ab639a43c to your computer and use it in GitHub Desktop.
Save ivanovs-4/9a4c91cfd2c91426ed6b8d7ab639a43c to your computer and use it in GitHub Desktop.
FastTrack setup alsamixer routing
# sudo apt-get install python-alsaaudio
import alsaaudio as a
def eq(q, p):
return q == p
def one2one(text):
return eq(*[int(v.strip()[-1]) for v in text.split('-')])
card = 2
mm = [
(name, a.Mixer(name, cardindex=card))
for name in a.mixers(card)
if 'Playback Volume' in a.Mixer(name, cardindex=card).volumecap()
]
for n, m in mm:
m.setvolume(100 if one2one(n) else 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment