magic behind rate~
I need to implement something like rate~ does in a c++ script, but I have no idea how it works. It's based on modulo % operators to produce smaller or longer cycles?
Can someone give me a hint?
Every help will be much appreciated!!
Thanks.
It's probably based on the slope of the incoming phasor signal.
in[x] - in[x-1] = slope
multiply this slope with the rate factor and use this new slope for the increment of an internal phasor.
I've never actually tried this...but it could work ;)
Hi Mudang,
I've followed your guide without success. Can you verify this please:
Thanks a lot!
Hi nik,
because you mentioned C++ i've used the array notation
in[x] - in[x-1]
which simply means: take every input sample and subtract the previous sample value from it.
in max the [delta~] object does exactly that.
You can then use the formula
delta * samplerate = frequency
to calculate the original frequency.
One thing I forgot to mention is that you have to take care, when the (original) phasor jumps from 1. to 0.
I hope this patch will clarify things.
There you can see two methods to generate the new phasor signal:
1. calculate the frequency and use a new phasor
2. use the modified slope directly as an increment for an accumulator (this is a common dsp method)
BTW, this patch doesn't do any synchronization yet!
cheers!
Hi guys,
This is really interesting! I'm currently converting a max patch I've created into a Pd patch, as it is now possible to use libPd for iOS apps. I've been struggling with how to recreate the rate object as I use it in the patch. It's not only being able to control the rate of the signal, but also being able to lock and unlock the sync to the master phasor. If you have any ideas on how to do it would be extremely grateful!
Best,
Christian
Hi Mudang,
cristal clear, thanks a lot.
Do you know how can we get synchronization so our new rate will stay in sync with the masterphase?
Thanks!!!