Re: The formula for the 100dB stroke fader?
Posted: 23 Jan 2012 17:19
Thanks guys!
I got the C-programming from the manufacturer instead the formula. I don't know if it works or even where I can plug those information in my fader on the Lemur app fader. Could you guys help me out?
It is like this-
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float DoUnlog(float val) {return (float) pow(10.0f, val/80.0f);}
static float MapFloatValue(float v)
{
const float _minLogResult = DoUnlog(-90.0f);
const float _maxLogResult = DoUnlog(+10.0f);
return (DoUnlog((v*100.0f)-90.0f)-_minLogResult)/(_maxLogResult-_minLogResult);
}
static float GetPositionPercentForDecibelValue(float dB)
{
return MapFloatValue((dB+90.0f)/100.0f);
}
int main(int argc, char ** argv)
{
if (argc < 2)
{
printf("Usage: ./a.out -15dB\n");
return 5;
}
float dB = atof(argv[1]);
float percent = GetPositionPercentForDecibelValue(dB)*100.0f;
printf("%.02fdB corresponds to a fader position at %.02f%%\n", dB, percent);
return 0;
}
Thanks for your help!
JJ
I got the C-programming from the manufacturer instead the formula. I don't know if it works or even where I can plug those information in my fader on the Lemur app fader. Could you guys help me out?
It is like this-
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float DoUnlog(float val) {return (float) pow(10.0f, val/80.0f);}
static float MapFloatValue(float v)
{
const float _minLogResult = DoUnlog(-90.0f);
const float _maxLogResult = DoUnlog(+10.0f);
return (DoUnlog((v*100.0f)-90.0f)-_minLogResult)/(_maxLogResult-_minLogResult);
}
static float GetPositionPercentForDecibelValue(float dB)
{
return MapFloatValue((dB+90.0f)/100.0f);
}
int main(int argc, char ** argv)
{
if (argc < 2)
{
printf("Usage: ./a.out -15dB\n");
return 5;
}
float dB = atof(argv[1]);
float percent = GetPositionPercentForDecibelValue(dB)*100.0f;
printf("%.02fdB corresponds to a fader position at %.02f%%\n", dB, percent);
return 0;
}
Thanks for your help!
JJ