Page 1 of 1
measuring speed of a fader?
Posted: Wed Oct 28, 2015 9:52 am
by mccy
Measuring the speed of a fader, how would you do that?
I'd like to have an output in numbers how fast I move a Fader for scratching, so sometimes it goes up and down very fast. I would need an algorithm which measures how much 'way' the fader goes, how fast it moves...
Any Ideas?
Martin
Re: measuring speed of a fader?
Posted: Wed Oct 28, 2015 11:50 am
by KG_is_back
Following ruby code should do it:
Code: Select all
def event(i,v,t)
if @pt #pt = previous time
dt=t-@pt #change in time
else
dt=1000.0 #if previous time doesn't exist make dt big
end
@pi=t
if @pv
output 0, (v-@pv)/dt #if previous value exists output speed = dv/dt
@pv=v
else
@pv=v
output 0,0.0 #if previous value doesn't exist, output zero.
end
end
Re: measuring speed of a fader?
Posted: Wed Oct 28, 2015 2:20 pm
by adamszabo
I wanted to try it but I get a syntax error saying unexpected $end or something
Re: measuring speed of a fader?
Posted: Wed Oct 28, 2015 3:08 pm
by KG_is_back
oops sorry... bad copy-paste... there should be one more "end" in the end. Fixed in the original post.
Re: measuring speed of a fader?
Posted: Wed Oct 28, 2015 11:29 pm
by mccy
Wow, thank you!!! I will try it in the next days & show you the result. I want to control a filter cutoff with it to avoid artefacts when moving the fader slowly.
Re: measuring speed of a fader?
Posted: Sun Nov 01, 2015 7:34 pm
by mccy
Re: measuring speed of a fader?
Posted: Sun Nov 01, 2015 8:16 pm
by adamszabo
mccy wrote:I want to control a filter cutoff with it to avoid artefacts when moving the fader slowly.
Thats exactly what I was planning to do as well! Would you mind posting a project with that part?
Re: measuring speed of a fader?
Posted: Mon Nov 02, 2015 8:46 am
by mccy
Had strange problems, when using midi or automation. Dropped the ruby thing.
All you need is a delay, substraction and some envelope following. It's so easy and I needed hours to get it:
- Calculate Signalchanges so that your values are 0-1 (ActualFaderposition) / (MaxFader-MinFader)
- use a sample delay with something above 100 samples (cant look right now)
- substract delayed signal from signal in time
- use some smoothing like envelope follower
=> you have the speed of the fader (between 0 &1)
- nothing simpler, to modulate a Filter with it!
Now it works with midi & automation & I love it!