Writing values directly to SIN0_RATE and SIN0_WIDTH

Algorithm development and general DSP issues

Moderator: frank

Post Reply
Digital Larry
Posts: 279
Joined: Mon Nov 12, 2012 12:12 pm
Contact:

Writing values directly to SIN0_RATE and SIN0_WIDTH

Post by Digital Larry » Tue Mar 14, 2017 7:28 pm

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

Iconnu
Posts: 10
Joined: Thu Apr 17, 2014 7:49 pm

Post by Iconnu » Thu Mar 16, 2017 5:05 pm

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

Digital Larry
Posts: 279
Joined: Mon Nov 12, 2012 12:12 pm
Contact:

Post by Digital Larry » Sun Mar 19, 2017 11:26 am

Thanks! I realize I already had answered this question, the trouble with my mind recently is where I left it. :lol:

knutolai
Posts: 33
Joined: Wed Nov 23, 2016 8:43 am
Location: Bergen, Norway

Post by knutolai » Thu Mar 23, 2017 3:01 am

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)

Post Reply