I’ve got a first pass of this working now and have come up with a control curve that I think works a lot better than the current slider.
Here’s one version of it with 0dB at the center:
Here’s another with 0dB shifted right and not as much top end gain:
I’ve removed the snapping at the 0dB point. I’m not sure how to best handle this - snapping makes it hard to make fine adjustments around the snap points. The current build has a flat spot in the curve at the 0dB point but it makes the math really messy.
So I’m thinking about some other alternatives - perhaps a right click menu for things like 0dB, -oo and perhaps ability to switch into a fine adjust mode. Not sure yet.
The slider implementation is done. I still need to figure out and update the level indicators and MIDI binding mapping.
Here’s an example control curve definition file: (feel free to give feedback on this)
{
// Definitions are a set of function and/or constants
"definitions":
{
// All control curves must provide these two functions
// (which must be the inverse of each other else weirdness will ensue).
// - Position ranges from 0.0 -> 1.0 and represents the slider position
// - Scalar is the amplitude scaling (ie: linear multiplier)
"positionToScalar(x)": "pow(10, (log(x, 10) * slope - (log(zeroDbPos, 10) * slope)) / 20)",
"scalarToPosition(x)": "pow(10, (log(x, 10) * 20 + (log(zeroDbPos, 10) * slope)) / slope)",
// Higher value makes the slope of the curve steeper and gives a higher top gain level
"slope" : 60,
// Position of the 0 dB mark
"zeroDbPos": 0.5,
},
"uiKinds":
{
"horizontalSlider":
{
"ticks":
[
{ "scalar": 0, "label": "-\u221E", },
{ "scalar": "fromDb(-45)", "label": "-45", },
{ "scalar": "fromDb(-30)", "label": "-30", },
{ "scalar": "fromDb(-20)", "label": "-20", },
{ "scalar": "fromDb(-15)", "label": "-15", },
{ "scalar": "fromDb(-9)", "label": "-9", },
{ "scalar": "fromDb(-6)", "label": "-6", },
{ "scalar": "fromDb(-3)", "label": "-3", },
{ "scalar": 1, "label": "0", },
{ "scalar": "fromDb(3)", "label": "+3", },
{ "scalar": "fromDb(6)", "label": "+6", },
{ "scalar": "fromDb(9)", "label": "+9", },
{ "scalar": "fromDb(12)", "label": "+12", },
{ "scalar": "fromDb(15)", "label": "+15", },
{ "scalar": "fromDb(18)", "label": "+18", },
]
}
}
}