Weird requirement, is there such a program that can press a key (i.e. F5) when Line-In audio goes over a certain level?

There is no macro program with this feature I believe having demoed a few and also looking at other feature lists. Similarly is the a program that can press a key (i.e. F5) when a blank (black) video turns all white. The video will go black again and then white at different intervals, each white interval same key will be pressed. thx.