Changing Fader Text Values

Hello Community!

I have a fader ("fader_ddl_time") and a text widget that displays the fader's value via this script in the text 'value'

JS{{
var val = @{fader_ddl_time}
return Math.round(val / 127 * 127)
}}

The fader is controlling via midi a delay time, is there a way to change the text readout to show the desired delay times and not the fader's value 1-127?

For example, on the text widget I would like the readout to show the following when the fader reaches a certain value:
show "1/16" = fader range 1-7
show "1/8" = fader range 8-15
show "1/4" = fader range 16-30

and so on, does that make sense? Appreciate in advance any assistance!

The most simple approach would be an if/else statement:

JS{
var val = @{fader_ddl_time}
if (val <= 7) return "1/16"
else if (val <= 15) return "1/8"
else if (val <= 30) return "1/4"
// etc
}

Works perfectly - elegant and simple!

As always, thank you so much for your invaluable assistance!