1 |
On Tue, 2010-08-17 at 19:17 -0400, Albert Hopkins wrote: |
2 |
|
3 |
> |
4 |
> This is a weird script. It's a ruby script that creates a web server, |
5 |
> but the web server listens for... |
6 |
> |
7 |
> It runs a python script that uses python-xlib to listen for key presses, |
8 |
> and when a key is pressed it uses curl to open the connection to the |
9 |
> ruby script.. when the ruby script receives a request it plays a sound. |
10 |
> |
11 |
> So really it's the Python script that's doing all the work... If you can |
12 |
> just try downloading the python script[1] and replacing 'curl |
13 |
> http://localhost:4567/key' with 'aplay myfile.wav' |
14 |
> |
15 |
> [1] |
16 |
> http://github.com/colszowka/linux-typewriter/blob/master/bin/keypress.py |
17 |
|
18 |
|
19 |
Here is my edit of his Python script. Basically the original author was |
20 |
making the wrong Python call to call aplay and, instead of looking up |
21 |
the documentation, he decided to create a ruby script that creates a web |
22 |
server to he can connect to it and play audio files :S |
23 |
|
24 |
Anyway this version seems to work for me. I modified it a bit to play a |
25 |
different file when the ENTER key is pressed and to mask aplay's output. |
26 |
|
27 |
Again, I acquired the wav files from: |
28 |
http://www.soundjay.com/typewriter-sounds.html |
29 |
|
30 |
-a |