This comparison is delved into in the sections in Ernest McClain's The Pythagorean Plato [1] which analyze Plato's Republic. McClain summarizes his somewhat remarkable claims thus:

> From a musician's perspective, Plato's Republic embodies a treatise on equal temperament. Temperament is a fundamental musical problem arising from the incommensurability of musical thirds, fifths, and octaves. The marriage allegory dramatizes the discrepancy between musical fifths and thirds
as a genetic problem between children fathered by 3 and those fathered by 5. The tyrant's allegory dramatizes the discrepancy between fifths and octaves as that between powers of 3 and powers of 2. The myth of Er closes the Republic with the description of how the celestial harmony sung by the Sirens is actually tempered by the Fates, Lachesis, Clotho and Atropos, who must interfere with
planetary orbits defined by integers in order to keep them perfectly coordinated. In Plato's ideal city, which the planets model, justice does not mean giving each
man (men being symbolized by integers) “exactly what he is owed,” but rather moderating such demands in the interests of “what is best for the city” (412e). By the 16th century A.D., the new triadic style and the concomitant development of fretted and keyboard instruments transformed Plato's theoretical problems into pressing practical ones for musicians and instrument makers. With the adoption of equal temperament about the time of Bach we made into fact what for Plato had been merely theory. Musically the Republic was exactly two thousand years ahead of time.

It would be easier to dismiss McClain's thesis as Bible Code
crackpottery if he didn't have such interesting things to say about the seemingly arbitrary numbers[2] appearing in Plato's writing.

For example, on 5040

> “Our songs have turned into laws!” Plato exclaims in one of his relentless puns in the dialogue Laws, this time on nomoi meaning both laws and traditional melodies for the recitation of the epics (799d). [...] The absolute population limit of 5,040 “landholders” will be analyzed as
the tonal “index” of a tuning system “fathered” by four primes, 2, 3, 5, and 7; the number 5040 = 2^4 x 3^2 × 5 × 7 defines a tuning system like that of Plato's friend Archytas, who is the earliest theorist credited with using 7 as a tone generator. Since 5,040 is also factorial seven (7! = 1 × 2 × 3 × 4 × 5 × 6 × 7)—i.e., just 7 times larger than factorial six (6! = 720) which defines the calendar octave, or Poseidon and his ten sons (cf. fig. 6) — we have a clue as to the identity of Plato's 37 guardians, 18 from the “parent city” and 19 “new arrivals,” for new arrivals among Plato's products are those generated by 7. [...]

Or, again, when McClain points out the relation between the number 729 - in Plato: the "distance" between the happiness of a king and that of a tyrant - and the simplest expression of the ratio of the Pythagorean comma: 531441::524288 (531441 is the square of 729)

Looked at this way, Plato's conclusion in the republic, that a society is just when each member of it deviates from their own interests just sufficiently to optimize for the interests of the society as a whole, is intended to map onto a truism of music theory - that an instrument, say a modern piano, is optimally in tune when each of its individual notes deviates from its own true value by the small amount required to keep the instrument as a whole sounding good.

This idea is the basis of various tuning systems including the predominant modern system known as "equal temperament."

1: https://ernestmcclain.files.wordpress.com/2017/05/plato_opti...

2: see, e.g. https://mathworld.wolfram.com/PlatosNumbers.html