I’m trying to take numerical values between 80 and 180 and convert them to frequency values of a c major scale, eg if the value 80 is input the note C 261.63hz is generated, 81 = D 293.66, 82 = E 329.63
Integrating the MIDI-to-frequency conversion into the expr object is left as an exercise for the reader.
The basic technique is to use *integer* arithmetic. Multiplication with 12 followed by division with 7 maps sequential integers to a diatonic pattern (half step/step/step/half step/step/step/step). The rest is just figuring out offsets to get the mode and tonic you want.