Real-time frequency recognition in python
Here's a recent blog post that may be helpful:

https://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/

You want to install numpy (and probably scipy, too), and read up on the Discrete Fourier Transform (DFT; this is what the FFT computes).  I'm not that up on Python media packages for the playback part. Python's wave module may be enough. 

The algorithm could be as simple as computing the FFT of the last, say, 4096 samples, getting the index of the maximum absolute value, and multiplying by the bin width.  Or you can get fancier and use a Hanning window, peak interpolation, overlap processing, and exponential averaging.