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 

Writing values directly to SIN0_RATE and SIN0_WIDTH

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

PostPosted: Tue Mar 14, 2017 6:28 pm    Post subject: Writing values directly to SIN0_RATE and SIN0_WIDTH Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Iconnu



Joined: 17 Apr 2014
Posts: 10

PostPosted: Thu Mar 16, 2017 4:05 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Digital Larry



Joined: 12 Nov 2012
Posts: 272

PostPosted: Sun Mar 19, 2017 10:26 am    Post subject: Reply with quote

Thanks! I realize I already had answered this question, the trouble with my mind recently is where I left it. Laughing
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: Thu Mar 23, 2017 2:01 am    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
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