Page 1 of 1

Writing values directly to SIN0_RATE and SIN0_WIDTH

Posted: Tue Mar 14, 2017 7:28 pm
by Digital Larry
I'm trying to map a scaled value of some other parameter to adjust the SIN LFO.

What are the decimal values that correspond to setting LFO rate to 25 and 125 (out of 511) using the WLDS instruction?

e.g.

SOF 0, 0.25
WRAX SIN0_RATE, 0

Similar question as regards the width. What would be the values to write to SIN0_WIDTH that would correspond to using values of 16 and 64 in the WLDS instruction?

Many thanks,

DL

Posted: Thu Mar 16, 2017 5:05 pm
by Iconnu
Kf = 2^17 (2 pi f / R)

f: Desired LFO frequency in Hz
R: Sample rate in Hz

Kf range: 0 to 511

Kf decimal = Kf / 512

25/512 = 0.048828125

125/512 = 0.244140625


--------------------------------------

Ka = N (32767/16385)

N: Delay length in samples

Ka range: 0 to 32767

Ka decimal = Ka / 32768

16/32768 = 0.00048828125

64/32768 = 0.001953125

the word is RANGE not WIDTH btw

Posted: Sun Mar 19, 2017 11:26 am
by Digital Larry
Thanks! I realize I already had answered this question, the trouble with my mind recently is where I left it. :lol:

Posted: Thu Mar 23, 2017 3:01 am
by knutolai
To find the frequency and delay length from Kf / Ka decimals:

From Kf decimal (K) to Frequency (f):

f = K * (512 * R) / ( 2^18 * pi)

R = sample rate (32768)

--------------------------------------------------

From Ka decimal (K) to delay length (a) :

a = K * (16385 * 32768 / 32767)