Code for mathematical music theory