There's an article on developerworks that might help...it uses perl to control sndpeek which does the hard work of analyzing the audio for you, the project reacts to sequences of tones :-)
http://www.ibm.com/developerworks/linux/library/os-whistle/index.html