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 

Knob variable power function?

 
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: 275

PostPosted: Sun Aug 06, 2017 7:30 am    Post subject: Knob variable power function? Reply with quote

I like to take a sine wave, and SOF it into the 0 to 1.0 range to use as a tremolo LFO (or any other LFO application). I also like to square or cube or beyond this sine wave so that it is "warped" but still smooth. What I'd like to do is have a knob that controls the level of warp from, say, 1 to 5. 1 would be the original signal, and 5 would be the signal to the 5th power.

Now of course I could do pot skipping and have each step be a different power step (via cascaded MULX instructions), but I want it to be smooth across pot rotation rather than jump between steps.

In regular math, I can do powers by taking the log, multiplying, and then taking the exponent of the result.

Super trivial example:

starting value is 100. I want to square this.

log10(100) = 2.
2 x 2 = 4.
10^4 = 10,000.

Suppose I want to do the "1.5" power:

log10(100) = 2.
2 x 1.5 = 3
10^3 = 1,000.

Anyone who wants to chime in with the answer is welcome to do so.

The goal:

Take an input control signal between 0.0 and 1.0.
Take a pot control signal and use this to continuously control "variable power" of the control signal from 1 to 5.

TIA,

DL
Back to top
View user's profile Send private message Visit poster's website
knutolai



Joined: 23 Nov 2016
Posts: 32
Location: Bergen, Norway

PostPosted: Wed Aug 09, 2017 1:35 am    Post subject: Reply with quote

The quick and maybe-not-so-dirty solution would be to crossmix between the "pure sine wave" and the "sine wave to the highest power you want available". I did a simulation in GeoGebra. You wont get the exact curve of the powers inbetween, but I doubt you'll notice much difference unless you set a very excessive "largest power".

Code:
ldax   maxpower
rdax   puresine, -1
mulx   POT0
rdax   puresine, 1
wrax   variablepower, 0
Back to top
View user's profile Send private message
Digital Larry



Joined: 12 Nov 2012
Posts: 275

PostPosted: Wed Aug 09, 2017 2:51 am    Post subject: Reply with quote

Interesting strategy! Those sine waves might have to be scaled down prior to running through the crossfade to avoid clipping but I may just give this a try.

(though since they are always in phase, perhaps not)!

Thanks,

DL
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