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 1Qyn9d-0007fN-I6 for garchives@archives.gentoo.org; Wed, 31 Aug 2011 15:56:41 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3AE3721C358; Wed, 31 Aug 2011 15:56:23 +0000 (UTC) Received: from mail-ew0-f53.google.com (mail-ew0-f53.google.com [209.85.215.53]) by pigeon.gentoo.org (Postfix) with ESMTP id 0EEB121C352 for ; Wed, 31 Aug 2011 15:54:28 +0000 (UTC) Received: by ewy8 with SMTP id 8so594447ewy.40 for ; Wed, 31 Aug 2011 08:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:to:subject:date:message-id:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:content-type; bh=9y5GZuaaLTQ+yqaFO2SbvxpZJhl/BlQTFAb2Pdy6Ii0=; b=FUlI/VI+Vh3LfkPiwItjrmI08q/Fmbf2fkpw/1GfrdFnnZn6XbrcydQUvy6GYAFwv8 P4HlxlZAtg7Iyoj9amHPiLSJbLDpvHqpuTYdEgmNVb+4Jr8ZAgsxEj5vfrt8tbkjkITj R6E+2CBDFxPyPf5iV/I1MuDshwiL68SRZKhSQ= Received: by 10.213.33.143 with SMTP id h15mr372209ebd.133.1314806068260; Wed, 31 Aug 2011 08:54:28 -0700 (PDT) Received: from localhost.localnet (ip-80-226-1-7.vodafone-net.de [80.226.1.7]) by mx.google.com with ESMTPS id 51sm3188236eec.44.2011.08.31.08.54.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 31 Aug 2011 08:54:27 -0700 (PDT) From: Volker Armin Hemmann To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Typewriter sound Date: Wed, 31 Aug 2011 17:54:15 +0200 Message-ID: <1370152.yyKSa8dbEO@localhost> User-Agent: KMail/4.7.0 (Linux/3.0.1; KDE/4.7.0; x86_64; ; ) In-Reply-To: <4E5E50C2.30900@gmail.com> References: <20100817172005.GA5110@solfire> <1282073645.451766.13.camel@paska> <4E5E50C2.30900@gmail.com> 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-15" X-Archives-Salt: X-Archives-Hash: 7bad9fa436a0a13cd407b4b00a54082c Am Mittwoch 31 August 2011, 17:18:26 schrieb Space Cake: > 2010-08-17 21:34 keltez=E9ssel, Albert Hopkins =EDrta: > > On Tue, 2010-08-17 at 20:43 +0200, meino.cramer@gmx.de wrote: > >> Bill Longman [10-08-17 20:16]: > >>> On 08/17/2010 10:56 AM, Albert Hopkins wrote: > >>>> On Tue, 2010-08-17 at 19:20 +0200, meino.cramer@gmx.de > >>>>=20 > >>>> wrote: > >>>>> Hi, > >>>>>=20 > >>>>> on YouTube there was a Blender-2.5 tutorial with audio. > >>>>> There was an interesting detail: While there were spoken > >>>>> instructions one can hear one typing on its keyboard. Each > >>>>> hit on one of the keys made the sound of an old typewriter > >>>>> (no, it was not the sound of the legendary "IBM Model M" > >>>>> keyboard ;) ). > >>>>>=20 > >>>>> How can I achieve this? What software can I use to make > >>>>> this geeky feature to come true. Unfortunately I have no > >>>>> idea, how to name this kind of what(?) ... > >>>>>=20 > >>>>> Thank you very much for any hint in advance! Best regards, > >>>>> mcc > >>>>=20 > >>>> There probably a number of ways to do this. > >>>>=20 > >>>> A cheap and easy way would be to use xev to monitor a window > >>>> and then pipe the stderr to a a program that waits for a > >>>> keypress event and then plays an apropriate. > >>>>=20 > >>>> A less cheap way would be to have our program do what xev > >>>> does instead of using a pipe. > >>>=20 > >>> Or you could set your X keyclick using xset. > >>=20 > >> Hi, > >>=20 > >> thanks a lot for your replies! :) Is there any program already, > >> which does this? A daemon or... > >>=20 > >> Best regards, mcc > >=20 > > Well I found out that when you pass window id to xev it does not > > trap keyboard presses per-s=E9. But there is another way... > >=20 > > Anway the following is a quick hack (in python). It pretty much > > works except it also seems to trap mouse presses. I got the .wav > > file at http://www.soundjay.com/typewriter-sounds.html > >=20 > > I tried using 'xset c' but it basically does nothing for me. My > > guess is that it does work it basically sends the a BELL to the > > console. > >=20 > >=20 > > --- 8< CUT HERE > > --------------------------------------------------- import sys > > import subprocess > >=20 > > soundfile =3D 'typewriter-key-1.wav' > >=20 > > def main(): window_id =3D sys.argv[1] cmd =3D ['xev', '-id', > > window_id] > >=20 > > p1 =3D subprocess.Popen(cmd, stdout=3Dsubprocess.PIPE) while True: = line > > =3D p1.stdout.readline() if line.find('atom 0x14d') > -1: > > subprocess.Popen(['aplay', soundfile], stderr=3Dopen('/dev/null', > > 'w')) > >=20 > >=20 > > if __name__ =3D=3D '__main__': main() >=20 > Guys, this is awesome :) Let's make an ebuild and put in portage :) >=20 > L: why?=20 man xset really guys. Why do it the long, hard and stupid way if there have bee= n=20 simple, built in solutions for longer than some of you live? --=20 #163933