Most of us, as children, have made several attempts at annoying our neighbors. The electronically inclined have attempted circuits producing random chirps, which when hidden in cupboards, produced the most annoying effects. Another was a tiny coin-cell battery operated beeper that produced a beep every minute or so, designed to make people go crazy. Now, you can use the Raspberry Pi (RBPi), the popular single board computer, and try different programs to see which of them can produce the most annoying effect on people nearby.
The Annoy-Pi, as this project has been named, pseudo-randomizes both the duration of the beep, and the delay between them. Unlike the coin-battery operated beeper, where the beep could be anticipated every minute or so, the Annoy-Pi prevents the ability to expect the beep at definite intervals. The random pitch, lasting for a random period, also prevents the ability to identify the actual source of the sound.
As the beeps are noticeably different, the victim is unable to immediately identify that the sound comes from the same source, and instead chalks it up to something else entirely. Changing the pitch of the sound randomly queers the situation further. For instance, when the beeps are extremely short and high-pitched, a person might wonder if they just heard something, rather than long enough to really hear something and register it. Neighbors find this to be far more annoying and aggravating rather than regular tones and intervals.
Electronic circuits produce random chirps in different ways. One of the methods is to use two unsynchronized timers—one running at a much higher frequency than the other does. The timer running at a lower frequency uses a lossy capacitor, making its frequency unpredictable. The low frequency timer also triggers its companion, and as they are not synchronized, the triggering occurs at random intervals. You can use the same technique for programming Annoy-Pi.
In programming Annoy-Pi, the principle of threading helps the concept of generating random beeps to a large extent. The operating system keeps track of the threads, which allows the program to switch from one thread to another when necessary, and to come back to its original thread once again.
One way to do this would be to have a cron job running at boot time, with the script waiting for a random 2-5 minutes before actually beeping. The next part of the code may be involved in deciding whether to continue beeping or to stop. If the two are not related to one another, the effect will be random one.
However, with all the threads running simultaneously, you must be careful to not let the script pause or stop suddenly with the threads still running. The threads need to be closed first and only then should the script stop.
As the entire exercise is based on a program, you can try creating random threads to generate various types of beeps to annoy people. Apart from being a prank exercise, the project has a deeper purpose—of stimulating the thought process of the programmer towards generating innovative ideas.