From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OllOF-0007En-OF for garchives@archives.gentoo.org; Wed, 18 Aug 2010 16:21:23 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 318BBE0A61; Wed, 18 Aug 2010 16:20:46 +0000 (UTC) Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.23]) by pigeon.gentoo.org (Postfix) with SMTP id AFD4FE0A63 for ; Wed, 18 Aug 2010 16:20:45 +0000 (UTC) Received: (qmail invoked by alias); 18 Aug 2010 16:20:44 -0000 Received: from p54851602.dip0.t-ipconnect.de (EHLO gmx.net) [84.133.22.2] by mail.gmx.net (mp011) with SMTP; 18 Aug 2010 18:20:44 +0200 X-Authenticated: #20088476 X-Provags-ID: V01U2FsdGVkX191qj1766B1GiBZiCDNiEfV9LyyywGp1D34yS4ILU aiLo1+6Ck2LVV0 Received: by gmx.net (nbSMTP-1.00) for uid 1001 Meino.Cramer@gmx.de; Wed, 18 Aug 2010 18:20:44 +0200 (CEST) Date: Wed, 18 Aug 2010 18:20:43 +0200 From: meino.cramer@gmx.de To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Typewriter sound Message-ID: <20100818162043.GC5324@solfire> References: <20100817172005.GA5110@solfire> <1282087043.456104.6.camel@paska> <1282088517.456104.20.camel@paska> <1282088652.456104.21.camel@paska> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1282088652.456104.21.camel@paska> User-Agent: mutt-ng/devel-r804 (Linux) X-Y-GMX-Trusted: 0 X-Archives-Salt: 9a708028-b07d-4775-b40b-c863dd54c3d8 X-Archives-Hash: 6d3fed15360cf7d16b01ee9a723d0e1e Albert Hopkins [10-08-18 04:16]: > On Tue, 2010-08-17 at 19:41 -0400, Albert Hopkins wrote: > > Here is my edit of his Python script. > > ... which I actually forgot to attach :| > > -a > > #!/usr/bin/env python > ## A tiny, nifty script for playing musical notes on each keypress. > ## > ## Copyright Sayan "Riju" Chakrabarti (sayanriju) 2009 > ## me[at]sayanriju[dot]co[dot]cc ## > ## Released under WTFPL Version 2 > ## (DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE) > ## Copy of license text can be found online at ## http://sam.zoy.org/wtfpl/COPYING > ## http://rants.sayanriju.co.cc/script-to-make-tick-tick-sound-on-keypress > > from Xlib.display import Display > import subprocess > import time > > KEYPRESSFILE = 'typewriter-key-1.wav' > RETURNFILE = 'typewriter-line-break-1.wav' > > notes=[440,494,523,587,659,698,784] > > ZERO,SHIFT,ALT,CTL=[],[],[],[] > ENTER = [0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] > for i in range(0,32): > ZERO.append(0) > if i==6: > SHIFT.append(4) > else: > SHIFT.append(0) > if i==4: > CTL.append(32) > else: > CTL.append(0) > if i==8: > ALT.append(1) > else: > ALT.append(0) > > ignorelist=[ZERO,ALT,SHIFT,CTL] > > def main(): > disp = Display() # connect to display > > while 1: #event loop > keymap = disp.query_keymap() > if keymap not in ignorelist: > filename = RETURNFILE if keymap == ENTER else KEYPRESSFILE > subprocess.Popen(['aplay', filename], stderr=open('/dev/null', > 'w')) > time.sleep(0.1) > > > if __name__ == '__main__': > main() Hi, I checked the script -- it works :) But it is to slow (my computer is to slow, I am too fast?) I can press twice the number of keys which got "sounded" by the script. Or is something wrong with the setup of my sound interface? My computer is a Athlon XP2 64 (32 bit Gentoo) 3800+, so I think, that it is not /that/ slow :) Any ideas? Best regards, mcc