Often I seem to want a fader that will transpose a frequency up and down through the harmonic sequence. In other words a fader that would go through the something like the following values to use as the frequency multiplier:
... 1/4, 1/3, 1/2, 1, 2, 3, 4 ...
I've found one way to do this (put in the frequency parameter of a Sound):
| h_sign |
h_sign := ((!Harmonic ge: 0) * 2 - 1).
default hz * ((!Harmonic + h_sign) ** h_sign)
If my !Harmonic fader has a range from -3 to +3 then this code would give:
1/4, 1/3, 1/2, 1, 2, 3, 4
So this works but is there a better way to do this?