View previous topic :: View next topic 
Author 
Message 
Digital Larry
Joined: 12 Nov 2012 Posts: 274

Posted: Mon Jul 31, 2017 3:38 pm Post subject: Tap Tempo tremolo again 


I referenced this older thread:
http://www.spinsemi.com/forum/viewtopic.php?t=397&start=0&postdays=0&postorder=asc&highlight=tap+tempo
I have some tap tempo code that can measure up to 1 second. The resulting value is 32767 *256 or "really close to 1.0". This maps to LFO freq or 1.0 Hz, or Kf = 26, and at the low end I'm going down to 1/20th of a second (which is probably faster than you can tap) at which point the LFO is at 20 Hz, where Kf = 502.
Now one approach is to interpolate linearly between these endpoints, but this does not really give the desired result at anywhere other than the endpoints. The real equation I am trying to implement is Kf = (8 * pi)/x, where x is the delay time in seconds, or essentially the number of samples counted between taps at 32768 Hz.
I've read the 1/X section at the knowledge base more than a few times and it is breaking my brain as I have not used the log/exp functions much and they are a little tough to understand.
http://spinsemi.com/knowledge_base/pgm_quick.html#1X_function_limiters
The input X will go from 0.05 to 1.0.
The output should go from 502 to 26 over this same range, of course that is scaled to the number representation used by the LFO.
Anyone want to help an old geezer out? Thanks! DL 

Back to top 


frank
Joined: 19 Oct 2005 Posts: 972

Posted: Mon Jul 31, 2017 5:14 pm Post subject: 


So if the input X goes 0.05 to 1.0 and needs to give an output of 502 to 26 and it is linear then the equation:
527.05263  X*501.05263
Should give a result between 502 and 26 for an input range of 0.05 to 1.0 for X _________________ Frank Thomson
Experimental Noize 

Back to top 


Digital Larry
Joined: 12 Nov 2012 Posts: 274

Posted: Mon Jul 31, 2017 5:46 pm Post subject: 


Hi Frank,
I don't want linear interpolation. I want the function (8 * pi)/x so that the tap interval maps as closely as possible to the LFO period.
I'll continue to attempt to muddle through with the LOG/EXP examples.
Thx,
DL 

Back to top 


frank
Joined: 19 Oct 2005 Posts: 972

Posted: Mon Jul 31, 2017 6:22 pm Post subject: 


Then I would try solving for 1/Kf instead so solve r=x/(8*pi) then do the 1/r to get the result. Since 1/8*pi is a constant it becomes a multiply _________________ Frank Thomson
Experimental Noize 

Back to top 


Aaron
Joined: 04 Mar 2015 Posts: 42

Posted: Wed Aug 02, 2017 5:40 am Post subject: 


Log rules dictate that:
log(a/b) = log(a)log(b)
and
log(a*b) = log(a)+log(b)
so for (8*pi)/x we can rewrite this as:
exp ( log( 8 )+log( pi )log( x ) )
in spin terms this would look like:
ldax x
;load x in acc
log 1,0.29
; ( logbase2(x) / 16 ) * 1 + ( logbase2(8*pi) / 16 )
exp 1,0
; 2^(acc*16) 

Back to top 


Digital Larry
Joined: 12 Nov 2012 Posts: 274

Posted: Wed Aug 02, 2017 8:48 pm Post subject: 


Thanks a lot for the clarification. I very carefully went through the 1/X example at the knowledge base and mapped it to my situation. Just about to test it. Be still my heart!
Update  it seems like it worked. To be completely up front, the value I'm really trying to get to is (8 * pi)/(x * 512) or maybe 512 should be 511 because I'm scaling the value to write into the LFO rate register. 

Back to top 


