I don’t know what the connection is, but music and mathematics are quite similar.
Pythagoras would agree!
There was a line in one of Poul Anderson’s science fiction books about “Bach, who spoke to God in mathematics”. I have forgotten which book, but not the line itself.