Knowledge-based pitch detection