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 <gentoo-user+bounces-127485-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QynXX-0004O5-N6
	for garchives@archives.gentoo.org; Wed, 31 Aug 2011 16:21:24 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4BA9A21C100;
	Wed, 31 Aug 2011 16:21:12 +0000 (UTC)
Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53])
	by pigeon.gentoo.org (Postfix) with ESMTP id 7AC7721C0BE
	for <gentoo-user@lists.gentoo.org>; Wed, 31 Aug 2011 16:20:17 +0000 (UTC)
Received: by bkbzs8 with SMTP id zs8so1272620bkb.40
        for <gentoo-user@lists.gentoo.org>; Wed, 31 Aug 2011 09:20:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=message-id:date:from:user-agent:mime-version:to:subject:references
         :in-reply-to:content-type:content-transfer-encoding;
        bh=tt9uDA7hONF9Z3Nn6YosyOH3hUPv8AG24QG/jkTXicQ=;
        b=ujzWKZ9S/qYA0EHN61diwu6YPeCNm4badjvo8PxiYliDmG6TusEhMI3MpWcvC3j4JV
         TU9bdsA85f+3qHctlzQ1j4GWQpaVJhNgP07s22fjfKMPnsLgDWz60BgspX57cKCq2MRC
         p9Q1Z0L2BeEw9UlKv7Gxrp3PvYhGr75u1d654=
Received: by 10.204.140.10 with SMTP id g10mr332672bku.406.1314807614985;
        Wed, 31 Aug 2011 09:20:14 -0700 (PDT)
Received: from brutal.emea.cpqcorp.net (business-80-99-239-77.business.broadband.hu [80.99.239.77])
        by mx.google.com with ESMTPS id f6sm434325bkw.30.2011.08.31.09.20.14
        (version=SSLv3 cipher=OTHER);
        Wed, 31 Aug 2011 09:20:14 -0700 (PDT)
Message-ID: <4E5E5F3D.7030905@gmail.com>
Date: Wed, 31 Aug 2011 18:20:13 +0200
From: Space Cake <spacecakex@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20110824 Thunderbird/6.0
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Typewriter sound
References: <20100817172005.GA5110@solfire> <1282073645.451766.13.camel@paska> <4E5E50C2.30900@gmail.com> <1370152.yyKSa8dbEO@localhost>
In-Reply-To: <1370152.yyKSa8dbEO@localhost>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: 7817f57cd767047ff952ac91f57cf876

On 2011. aug. 31., szerda, 17.54.15 CEST, Volker Armin Hemmann wrote:
> Am Mittwoch 31 August 2011, 17:18:26 schrieb Space Cake:
>> 2010-08-17 21:34 keltez=C3=A9ssel, Albert Hopkins =C3=ADrta:
>>> On Tue, 2010-08-17 at 20:43 +0200, meino.cramer@gmx.de wrote:
>>>> Bill Longman <bill.longman@gmail.com> [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
>>>>>>
>>>>>> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> 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 ;) ).
>>>>>>>
>>>>>>> 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(?) ...
>>>>>>>
>>>>>>> Thank you very much for any hint in advance! Best regards,
>>>>>>> mcc
>>>>>>
>>>>>> There probably a number of ways to do this.
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>> A less cheap way would be to have our program do what xev
>>>>>> does instead of using a pipe.
>>>>>
>>>>> Or you could set your X keyclick using xset.
>>>>
>>>> Hi,
>>>>
>>>> thanks a lot for your replies! :) Is there any program already,
>>>> which does this? A daemon or...<insert missing words here>
>>>>
>>>> Best regards, mcc
>>>
>>> Well I found out that when you pass window id to xev it does not
>>> trap keyboard presses per-s=C3=A9.  But there is another way...
>>>
>>> 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
>>>
>>> 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.
>>>
>>>
>>> --- 8< CUT HERE
>>> --------------------------------------------------- import sys
>>> import subprocess
>>>
>>> soundfile =3D 'typewriter-key-1.wav'
>>>
>>> def main(): window_id =3D sys.argv[1] cmd =3D ['xev', '-id',
>>> window_id]
>>>
>>> p1 =3D subprocess.Popen(cmd, stdout=3Dsubprocess.PIPE) while True: li=
ne
>>> =3D p1.stdout.readline() if line.find('atom 0x14d') > -1:
>>> subprocess.Popen(['aplay', soundfile], stderr=3Dopen('/dev/null',
>>> 'w'))
>>>
>>>
>>> if __name__ =3D=3D '__main__': main()
>>
>> Guys, this is awesome :) Let's make an ebuild and put in portage :)
>>
>> L:
>=20
> why?=20
> man xset
>=20
>  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?

I can't achieve the same with xset :) but this solution is working very=20
well, this is a really important project showing the power of=20
opensource :)

L: