Music has everything to do with mathematics. It’s all waves just like y = sin(x). Digital music in particular has much in common with calculus in the piecewise manner that discrete samples approximate analog waves. I wrote a program in vanilla JS to demonstrate this idea. It converts XML-formatted music into mathematical terms, and then encodes it into pulse code modulation for playback. Feel free to peek at dietpumpkinmachine.com if you don't mind the sloppy code.