There's a commercial product called "Annoy-a-tron" that does that.
When I started a new job at a NOC, I was pranked with one of those. I didn't know what to make of the odd recurring ~12khz beeps, and figured it was some old device slowly dying. So I pulled out a stopwatch to see if I could suss out the interval on the beeping. I was too focused on timing the beeps to notice my coworkers exchanging glances with each other after asking them, "Does anyone else hear that?"
I found a pattern emerge. It repeated itself every 10 beeps or so, with irregular intervals between those beeps. Armed with that information, I could effectively predict the next beep within 3-5 seconds (intervals ranged between 3-10 minutes, if I recall.) So I started walking around the room, standing in different locations as I stared at my stopwatch. The farther apart the places I stood, the better chance I'd have of triangulating the source with each beep.
I got within 3-5 feet of it in the ~300 square foot room before the coworkers came clean about what they had done. I wasn't even mad, I was having a blast!
Of course, while he was explaining this to me, the chip slipped from my fingers and fell down an air vent of another friend’s living room. The comedic timing was perfect, and it really might have been the funniest thing to happen to me in 2012.