Examples and code for pitch detection and musical scales