Using a script to convert a value to semitones

Hi there,

I am busy mapping the new Arturia MiniFreak to a template and have a quick question about how I can convert a knob's value to display semitones in a text box. I cannot figure out the syntax, but basically the knob goes from -48 st to +48 st (0 being 0.5 on the knob), so each 0.96 increment is another semitone.

Been struggling to figure out a script that would simplify this process (save from long handing all of the values one at time!).

Any help greatly appreciated!

// knob onValue: convert 0, 1 range to -48, 48 
set('text_id',  Math.round(value * 96) - 48)
3 Likes

Works perfectly thanks! Many thanks for solving this for me Jean-Emmanuel, would have never got there myself!