Found in 2 comments on Hacker News
kian · 2020-02-28 · Original thread
If you're looking for a book, Music: A Mathematical Offering is pretty good. But you're nearly a the end of your recursion, though. Wikipedia ought to take you the rest of the way to answering those basic questions. More complex questions like why certain combinations sound good whe next to one another, on the other hand...
I am an audio engineer with a heavy emphasis on the computer science end of things, and this is recommended reading for anyone that works on my team.

If you prefer to have an actual book, it is directly available for purchase on Amazon:

Fresh book recommendations delivered straight to your inbox every Thursday.