Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32084

Re: Listen for changes in variable (alsaaudio.Mixer(x, x).getvolume(x)

Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'received:209.85.223': 0.03; 'calls.': 0.07; 'think,': 0.07; 'python': 0.09; 'subject:skip:a 10': 0.09; 'throw': 0.09; 'cc:addr :python-list': 0.10; '24,': 0.16; 'fine).': 0.16; 'oct': 0.16; 'poll': 0.16; 'popen,': 0.16; 'subject:variable': 0.16; 'sys.exit(1)': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'shell': 0.18; 'changes': 0.20; 'all,': 0.21; '3.x': 0.22; 'cc:2**0': 0.23; 'apps': 0.23; 'changes,': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'second': 0.24; 'linux': 0.24; 'command': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'extend': 0.26; 'skip:# 10': 0.27; 'message- id:@mail.gmail.com': 0.27; 'lines': 0.28; 'url:mailman': 0.29; "i'm": 0.29; 'that.': 0.30; 'url:python': 0.32; 'etc.)': 0.32; 'url:listinfo': 0.32; 'certain': 0.33; 'docs': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'except': 0.36; 'but': 0.36; 'url:org': 0.36; 'actions': 0.36; 'level.': 0.36; 'should': 0.36; 'subject: (': 0.36; 'possible': 0.37; 'option': 0.37; 'level': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'little': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'your': 0.60; "you've": 0.61; 'first': 0.61; 'course.': 0.62; 'close': 0.63; 'sound': 0.65; 'subject:,': 0.81; 'listens': 0.84; 'windowing': 0.84; '(running': 0.91; 'maarten': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7WUDC8w7xblq7SGcjqyCEdmfWWx3/bMgLneLQ+LylcU=; b=x26KdCcxjRQu7BWfDwm520vDqClsGPUYFSLclR80pMRFA6oFcNXyTUBcaS5atW8RNp /o/7FX5qGpdy6Ns0eyvbGC6hUaQu/mTBGhD/BoAS5ufdVUzDp/9AVTak8lMGYeNYucrB yyPk278AZQKEem9DLc+QIq4hCCUGu8+JzmUC1d/bYboW4AJ6Zkc31/Lph3I3VnEBVxwl Uk1elAGUqbBKBlq8DAqdLpwRq6g0QCPOF5a0qLB1pSJnJwDYagea681Asd7h32qhgK8J d5ikbKWoOJi/fPBM9w5Lr33Av9n/ThpJBwRqgmvUmTYhY6uP2nlFFC6m8USvYOwoeTvW dDUw==
MIME-Version 1.0
In-Reply-To <508839a7$0$785$58c7af7e@news.kabelfoon.nl>
References <508839a7$0$785$58c7af7e@news.kabelfoon.nl>
Date Wed, 24 Oct 2012 21:35:37 -0400
Subject Re: Listen for changes in variable (alsaaudio.Mixer(x, x).getvolume(x)
From David Hutto <dwightdhutto@gmail.com>
To Muffinman <news**REMOVETHIS**@koster.tk>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2808.1351128940.27098.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351128940 news.xs4all.nl 6902 [2001:888:2000:d::a6]:52820
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:32084

Show key headers only | View raw


On Wed, Oct 24, 2012 at 2:55 PM, Muffinman <news**REMOVETHIS**@koster.tk> wrote:
> Hello all,
>
> I'm new to Python (running 2.6.6 but if necessary 3.x should also be
> fine). I have a little idea I hope to accomplish with Python. I want to
> listen for changes in Alsa sound volume level and base some actions on
> that.

With the few lines below I can check the current volume level. Can
> I extend this so that the script listens for changes in the volume level
> and I can base some actions on it? As speed is quite important it's not
> an option to poll every second or so for changes, it has to be close to
> instantaneous.
>
> If this is not possible with Python, any suggestions on what else are
> also welcome of course.
>
> Thanks in advance, Maarten
>
>
> #############
> try
>     mixer = alsaaudio.Mixer(Fake, 0)
> except alsaaudio.ALSAAudioError:
>     sys.stderr.write("No such mixer\n")
>     sys.exit(1)
>
> volumes = mixer.getvolume(1)
> #############
> --
> http://mail.python.org/mailman/listinfo/python-list


first look at the docs for command line functions that utilize the
command line for access to certain CL apps.

Once you've found a way to access the CL apps with python(I use
subprocess.call usually, I think, but there's popen, etc.) then use
man alsamixer, or man aplayer, or man arecorder. in the shell on your
linux distro.

Then throw in a little tkinter, or a windowing system of your choice,
and distort the changes with command line calls.


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Listen for changes in variable (alsaaudio.Mixer(x,x).getvolume(x) Muffinman <news**REMOVETHIS**@koster.tk> - 2012-10-24 20:55 +0200
  Re: Listen for changes in variable (alsaaudio.Mixer(x,x).getvolume(x) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-24 22:58 +0000
  Re: Listen for changes in variable (alsaaudio.Mixer(x, x).getvolume(x) David Hutto <dwightdhutto@gmail.com> - 2012-10-24 21:35 -0400
  Re: Listen for changes in variable (alsaaudio.Mixer(x, x).getvolume(x) David Hutto <dwightdhutto@gmail.com> - 2012-10-24 21:42 -0400
  Re: Listen for changes in variable (alsaaudio.Mixer(x,x).getvolume(x) Tim Roberts <timr@probo.com> - 2012-10-24 22:59 -0700

csiph-web