Spin Semiconductor Forum Index Spin Semiconductor
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tap Tempo tremolo again

 
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development
View previous topic :: View next topic  
Author Message
Digital Larry



Joined: 12 Nov 2012
Posts: 274

PostPosted: Mon Jul 31, 2017 3:38 pm    Post subject: Tap Tempo tremolo again Reply with quote

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
View user's profile Send private message Visit poster's website
frank



Joined: 19 Oct 2005
Posts: 972

PostPosted: Mon Jul 31, 2017 5:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Digital Larry



Joined: 12 Nov 2012
Posts: 274

PostPosted: Mon Jul 31, 2017 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
frank



Joined: 19 Oct 2005
Posts: 972

PostPosted: Mon Jul 31, 2017 6:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Aaron



Joined: 04 Mar 2015
Posts: 42

PostPosted: Wed Aug 02, 2017 5:40 am    Post subject: Reply with quote

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 re-write 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
View user's profile Send private message
Digital Larry



Joined: 12 Nov 2012
Posts: 274

PostPosted: Wed Aug 02, 2017 8:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group