Learning to do this is very much like a computer being programmed, and this for centuries before there were computers. The piano represents an intermediate case, since it is analog as to dynamics but digital as to pitch. Now add in all the wind instruments and percussions, still generally written for in the same digital staff notation, and having various degrees of analog or digital nature in their sounds. The confusion is really confounded, when one kind of notation has to serve for so many different instruments and ways of playing them. The fretted instruments, typified by the guitar, are digital as to pitch just as the piano is, so that leads us to the subject of tempered scales.
Most music has an orderly structure.
The engineer or programmer will make this sound more businesslike and scientific by calling it quantizing . Again, this is quantizing process, imagining that things proceed in sudden steps or jumps. Since we have covered the tempered and just musical scale question in many other publications, we won't go to too much detail here. Yet the interval-spacing of the resulting sounds is equal. This is like the graduations on a slide-rule, and there is a mathematical similarity.