Tap Tempo tremolo again
Moderator: frank
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Tap Tempo tremolo again
I referenced this older thread:
http://www.spinsemi.com/forum/viewtopic ... =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_ ... n_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
http://www.spinsemi.com/forum/viewtopic ... =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_ ... n_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
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
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
Experimental Noize
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
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
Experimental Noize
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
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.
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.
Re: Tap Tempo tremolo again
Hi Larry
can you share your final code? I'm trying to achieve the same thing, I guess (adapting the infamous tap tempo delay to a sin LFO for a tremolo), and it would be helpful, because my head is spinning with so many number conversions....
Regards
can you share your final code? I'm trying to achieve the same thing, I guess (adapting the infamous tap tempo delay to a sin LFO for a tremolo), and it would be helpful, because my head is spinning with so many number conversions....
Regards
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Re: Tap Tempo tremolo again
Sorry, I can't share the code as it was for a commercial customer.
DL
DL
Re: Tap Tempo tremolo again
Ok, I understand
what I came up with is a variation of the code above, changing the parameter of the log instruction
But I didn't test it yet. Later today I will burn it and test if my calculations are right.
what I came up with is a variation of the code above, changing the parameter of the log instruction
Code: Select all
...
ldax taptempo
;load tempo in acc
log -1,-0.27178149
; ( logbase2(x) / 16 ) * -1 + ( logbase2(8*pi/ 512)/16 )
exp 1,0
; 2^(acc*16)
WRAX SIN0_RATE,0.00
...
Re: Tap Tempo tremolo again
Quick update before going to bed.....
The formula works as expected, and everything fine. But it took me 2 hours of dumb troubleshooting because it was not working initially... and the failure was that I copy-pasted some code and did not check that the registers were duplicated (stupid me).
So, the code looks like this:
once you have your taptempo register calculated....
and if you want to control a ramp LFO....
I hope it gets useful for someone in the future.
The formula works as expected, and everything fine. But it took me 2 hours of dumb troubleshooting because it was not working initially... and the failure was that I copy-pasted some code and did not check that the registers were duplicated (stupid me).
So, the code looks like this:
once you have your taptempo register calculated....
Code: Select all
...
ldax taptempo
; do the magic
;load tempo in acc
log -1,-0.27178149
; ( logbase2(x) / 16 ) * -1 + ( logbase2(8*pi/ 512/16 )
exp 1,0
; 2^(acc*16)
wrax sin0_rate,0
...
Code: Select all
...
ldax taptempo
; do the magic
;load tempo in acc
log -1,-0.2499428
; ( logbase2(x) / 16 ) * -1 + ( logbase2(8*pi/ 512/16/0.7849 )
exp 1,0
; 2^(acc*16)
wrax rmp1_rate,1
...