1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
2010-08-17 21:34 keltezéssel, Albert Hopkins írta: |
5 |
> On Tue, 2010-08-17 at 20:43 +0200, meino.cramer@×××.de wrote: |
6 |
>> Bill Longman <bill.longman@×××××.com> [10-08-17 20:16]: |
7 |
>>> On 08/17/2010 10:56 AM, Albert Hopkins wrote: |
8 |
>>>> On Tue, 2010-08-17 at 19:20 +0200, meino.cramer@×××.de |
9 |
>>>> wrote: |
10 |
>>>>> Hi, |
11 |
>>>>> |
12 |
>>>>> on YouTube there was a Blender-2.5 tutorial with audio. |
13 |
>>>>> There was an interesting detail: While there were spoken |
14 |
>>>>> instructions one can hear one typing on its keyboard. Each |
15 |
>>>>> hit on one of the keys made the sound of an old typewriter |
16 |
>>>>> (no, it was not the sound of the legendary "IBM Model M" |
17 |
>>>>> keyboard ;) ). |
18 |
>>>>> |
19 |
>>>>> How can I achieve this? What software can I use to make |
20 |
>>>>> this geeky feature to come true. Unfortunately I have no |
21 |
>>>>> idea, how to name this kind of what(?) ... |
22 |
>>>>> |
23 |
>>>>> Thank you very much for any hint in advance! Best regards, |
24 |
>>>>> mcc |
25 |
>>>> |
26 |
>>>> There probably a number of ways to do this. |
27 |
>>>> |
28 |
>>>> A cheap and easy way would be to use xev to monitor a window |
29 |
>>>> and then pipe the stderr to a a program that waits for a |
30 |
>>>> keypress event and then plays an apropriate. |
31 |
>>>> |
32 |
>>>> A less cheap way would be to have our program do what xev |
33 |
>>>> does instead of using a pipe. |
34 |
>>> |
35 |
>>> Or you could set your X keyclick using xset. |
36 |
>>> |
37 |
>> |
38 |
>> Hi, |
39 |
>> |
40 |
>> thanks a lot for your replies! :) Is there any program already, |
41 |
>> which does this? A daemon or...<insert missing words here> |
42 |
>> |
43 |
>> Best regards, mcc |
44 |
>> |
45 |
>> |
46 |
> |
47 |
> Well I found out that when you pass window id to xev it does not |
48 |
> trap keyboard presses per-sé. But there is another way... |
49 |
> |
50 |
> Anway the following is a quick hack (in python). It pretty much |
51 |
> works except it also seems to trap mouse presses. I got the .wav |
52 |
> file at http://www.soundjay.com/typewriter-sounds.html |
53 |
> |
54 |
> I tried using 'xset c' but it basically does nothing for me. My |
55 |
> guess is that it does work it basically sends the a BELL to the |
56 |
> console. |
57 |
> |
58 |
> |
59 |
> --- 8< CUT HERE |
60 |
> --------------------------------------------------- import sys |
61 |
> import subprocess |
62 |
> |
63 |
> soundfile = 'typewriter-key-1.wav' |
64 |
> |
65 |
> def main(): window_id = sys.argv[1] cmd = ['xev', '-id', |
66 |
> window_id] |
67 |
> |
68 |
> p1 = subprocess.Popen(cmd, stdout=subprocess.PIPE) while True: line |
69 |
> = p1.stdout.readline() if line.find('atom 0x14d') > -1: |
70 |
> subprocess.Popen(['aplay', soundfile], stderr=open('/dev/null', |
71 |
> 'w')) |
72 |
> |
73 |
> |
74 |
> if __name__ == '__main__': main() |
75 |
> |
76 |
> |
77 |
> |
78 |
Guys, this is awesome :) Let's make an ebuild and put in portage :) |
79 |
|
80 |
L: |
81 |
|
82 |
-----BEGIN PGP SIGNATURE----- |
83 |
Version: GnuPG v2.0.17 (GNU/Linux) |
84 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ |
85 |
|
86 |
iQEcBAEBAgAGBQJOXlDCAAoJECu/a/sBwapoXS0IAMKolA55zV/mAQqlwe/qvk1w |
87 |
HyVpirrOYYYQOsdJChnvYfpgWBUT0F8uwEaO1pLGdlACrN0VHYJMk45nC8PBtKkL |
88 |
gkrnR0Q0Ew6bZ1DeXjd2x+jZEN5Am6vQCHxLd85OJfTvIM7Ahc+FdJWtfhcaO8IF |
89 |
hXppxITOQ9hCH+iEhel6TTq4wAQjX/i0C6RsF9RTGbocAzCdpZSs/RPffQiHuScv |
90 |
IBrKOxLCQ2TACmdYmbK47vCKH6rgsNDENWD19g9zVouHHtXLeBnavG42wV46qCUW |
91 |
OmNoKFA00ZXmuVUhpyUhhLSv6D4n5w7TFKdNXFof6Whf6/9X82oVe4yQCgbC+E8= |
92 |
=R2iT |
93 |
-----END PGP SIGNATURE----- |