I will have a look on this later, but as for the 120 inside the [expr], that's because the unit used here is semitone/10. Look, There are 12 semitones in an octave, meaning that to double the frequency of something you need 12 semitones. So you will find that the formula that gives the ratio between two frequencies using their difference in semitones is [expr pow(2, $f1/12]; for instance, input a difference of 0 semitones between them and the ration becomes 1 (same frequencies), or input a difference of 12 semitones and the ratio becomes 2 (an octave, such as between 220Hz and 440Hz). So in the case above, since the unit is semitone/10 (selected to give more precision to the user, so you can also use micro intervals), there are 120 of them in each octave and the same as logic described above applies.
As for the rest, I will have a look later and see if I figure it out.