[linux-audio-dev] LADSPA proposal ...

Mike Rawes mike_rawes at yahoo.co.uk
Sat May 15 08:40:31 UTC 2004


On Sat, 15 May 2004 07:10:30 +0200
Marcus Andersson <marcus.t.andersson at spray.se> wrote:

> Fons Adriaensen wrote:
> 
> >On Fri, May 14, 2004 at 05:55:07PM +0200, Marcus Andersson wrote:
> >  
> >
> >>Alfons Adriaensen wrote:
> >>
> >>    
> >>
> >>>Another point. I've defended the adoption of simple integer
> >enumerations>>
> >>>(corresponding to a C switch) using the argument that it is the
> >single>>missing essential feature in the port information. At the
> >Karlsruhe BOF>>it was said that this is not true, as the LOGARITHMIC
> >hint does not>>specify the log base. Indeed it doesn't, nor is there
> >any reason why>>it should. The LOG hint means that the user would
> >expect a widget, e.g.>>a slider, that maps a certain displacement to
> >a certain ratio (as opposed>>to difference) of the controlled
> >parameter. So the host has to do a linear>>to exponential conversion,
> >but it is completely irrelevant to what base>>this calculation is
> >done.>>
> >>>      
> >>>
> >>I thought the idea with the LOGARITHMIC hint was to maximize the 
> >>controllability of the parameter and make use of the entire slider
> >range >better. If the base is left out, the host will have to guess,
> >and most >often miss the optimal slider mapping.
> >>    
> >>
> > 
> >Sorry but this is wrong. For example, if the range is 1 to 1000, then
> >it's clear that 10 will be at 1/3 and 100 at 2/3 of the slider range.
> >This does not depend on the log base at all.
> >
> >  
> >
> 
> Interesting interpretation. This means that the mapping between the 
> slider and the parameter will be
> 
> f(x) = k*a^x
> 
> with k=f(0) and a = f(1) if the slider goes form 0 to 1.
> 
> In the example above, k=1 and a=1000.
> 
> This also means that it is illegal to include 0 in the parameter
> range.
> 
> If this is what we want LOGARITHMIC to mean, it should be documented
> to this detail in the LADSPA specification. Otherwise, host and plugin
> 
> writers might get it wrong.

You're right - there's an asymptote at x=0 - there's no correct way of
dealing with it. What I've done in the past is do linear conversion near
0:

to linear:
value >  e : log(value) 
      < -e : -log(-value)
           : value / e

to logarithmic
value >  1 : exp(value)
      < -1 : -exp(-value)
           : value * e

However, it is also perfectly valid to simply clip the lower bound. What
isn't right is for a host to *assume* that the lower bound of a
LOGARITHMIC
port is always > 0. I myself want to be able to specify a logarithmic
frequency port with range + / - 24000 for my oscillator plugins, without
having a host break by doing log(-440) or something.

Fons is right about the base. It will have no bearing on the behaviour
of slider.

- 
Myk





More information about the Linux-audio-dev mailing list