Mapping float value to frequency (Hz) or dB

Your JS{{}} block should go in the value property. The script property works differently.

What code would I need to introduce to map these values

Well that really depends on how the X32 maps the value on its side, if the mapping is linear it would look like this:

JS{{
return 20 + @{HPF} * 380 
}}

If it's logarithmic you'll need to use some Math functions.

Case 2: Fader dB values
I'm fairly certain that this would be answered by a combination of case 1 and the use of the logScale function.

The logScale property only change how the values are distributed on the fader's scale, but it won't apply any conversion on the output value.

From the X32 wiki:

The Range, level has 4 ‘linear’ dB ranges:
0.0…0.0625 (-oo, -90…-60 dB),
0.0625…0.25 (-60…-30 dB),
0.25…0.5 (-30…-10dB)
0.5…0.1 (-10…+10dB)

If you just need the fader's scale to be displayed, setting its pips to true and range property as follows wil do: (logScale should be set to false)

{
  "0%": { "-90dB": 0 },
  "12.5%": { "-60dB": 0.0625 },
  "25%": { "-30dB": 0.25 },
  "50%": { "-10dB": 0.5 },
  "75%": { "0dB": 0.75 },
  "100%": { "10dB": 1 }
}

This way the fader will still send values between 0 and 1 but will display the appropriate scale.

1 Like