[Ardour-Dev] gain-mapping - was Re: OSC next

Len Ovens len at ovenwerks.net
Sat May 14 07:41:31 PDT 2016


On Sat, 14 May 2016, Robin Gareus wrote:

> On 05/13/2016 08:53 PM, Len Ovens wrote:
>> On Fri, 13 May 2016, Melanie Bernkopf wrote:
>>
>>> yes I can only give a full ack to this it is just mimic of the
>>> position and not about gain or DB.
>
> At first thought, I think this is not a good idea.
>
> It would limit the control surface to the same fader-deflection which
> Ardour chose and does not expose any actual relevant numerics.
>
> But the lack of a well defined "no gain" 0dB point is the most obvious flaw.

Yes.
>
> Internally Ardour uses a floating point gain-factor (coefficient) for
> both: state and processing. Resetting a fader sets it exactly to 1.f and
> the control has a detent (in the GUI) because it is impossible to
> otherwise reach this point (With integer ratios 41 bits of precision are
> required for the power law to result in exactly 1.f).

The use of 1024 is intentional. 10 bits is a very common ADC size in small 
processors. Because 1024 is an exact number of bits it is easy with no 
floating point math to convert to 8 bit (common for encoders) just by 
shifting the value. While moving to 16bit would be reasonable (a 16bit 
register is needed for 10 bit anyway) 41 bit would be beyond easy use with 
many microprocessors.

> You'll need to add a factor much much larger factor than 1024 to
> represent unity gain with an exact integer.

I think it would be better to shift the 1024 a bit and let it over hang 
one end or the other. I would like the number at 0dB to be shiftable to 7 
bits if possible. This would allow a MIDI CC converted to OSC to still 
work.

>> So with dB, I can on
>> the surface enter as text an exact gain in dB. Also, the text value on
>> the surface shows the value in dB which is much more useful to the user
>> than some number from 0 to 1023.
>
> exactly.
>
>
> However, are there any OSC controllers out there that can provide a
> power-law fader?
>
> As far as I know the answer is no. Furthermore neither log-scale (dB)
> nor linear (coefficient) are appropriate for a fader.

With break points yes. How smooth is the transition from from scale to 
scale? It has not been noticable so far as I can tell. What I have done 
for my faders is that between breakpoints I map linear DB, that is each 
tick (smallest resolution movement) is the same change in dB. The changes 
from section to section are a small change in the amount of dB per tick 
with the exception of -60 to inf (-200... though on Ardour's side -200 is 
-193 = inf)

Still, not common or perhaps correct to the purist.

> One way would be to add a *new* interface specifically for OSC with the
> following properties:
>
> - power-scale - similar to Ardour's Fader
> - 0dB can be represented by an integer fraction with small denominator.
> - the range is independent of Ardour's max_gain configuration
> - relatively simple relation to dB.
>
> One candidate that fulfills these criteria is
>
> $g = (1.26 p)^3 ; 0 \leq p \leq 126; p \in \mathbb{Z}_{\geq 0}$
>
> with x = 100 / 126 this results in a gain = 0dB
> and x = 126/126; gain ~= +6dB
>
> This could also be mapped to MIDI 0..127 with a small overshoot (1.26 *
> 127 / 126)^3 = 6.23 dB  and OSC could use 0 .. 1260  with unity at 1000.

This would make no more sense than position as 0->1 for most hw control 
surfaces that want to do all integer math. Finding an ADC that has FS of 
1260 is not going to happen. 1023 is full scale because that is what the 
fader will put out when it is at the top of it's range. However, if we 
take your values for 126/127 and shift left, we end up with +6 at 1008. 
While 15 ticks sounds like a lot of wasted travel, it is really only 1.5%.

The other method of doing the same thing, is to continue to use the 
internal fader math and add an offset of -0.006990539841353893 to the 1024 
value. This would make 800 = 0dB and full scale just slightly less than 
+6. Shifting right to 7 bits for CC gives that magical 100. It would mean 
at 7 bits fs would −0.11184863 dB.

I shall have to try both to how they "feel".

> This interface would be available in *addition* to a dB interface (two
> in total).

Only two kinds of math would be nicer than the four I have now... this at 
least can be considered done. I think It should be no problem in this case 
to allow a surface that is getting it's feed back in one math to be able 
to control Ardour in both. This would allow a positional fader with the 
ability to set the level in dB.



--
Len Ovens
www.ovenwerks.net


More information about the Ardour-Dev mailing list