"The connection of the senses is very loose; some of them appear to have arisen quite independently of each other from different applications of BE- pref." [OED]
"Ut queant laxis resonare fibris
Mira gestorum famuli tuorum
Solve polluti labii reatum,"etc. Gamut came to be used for "the whole musical scale" by 1529; the figurative sense of "entire scale or range" of anything is first recorded 1626.