# LFO Rate question

Hi,
I know from the Ambika manual that when set to Hz, the LFO rate parameter goes from 0.06 Hz (0) to 100 Hz (127). Can anyone tell me if there is a table of rate to Hz values? Or is there a simple formula for the less maths-inclined? Thanks!

Hi,

I don’t think there’s any table or formula for the Ambika lfo rates available in public. Based on the lfo lookup tables in the source code the lfo range stretch from 1/16 Hz to 100 Hz in a logarithmic scale: https://github.com/pichenettes/ambika/blob/master/controller/resources/lookup_tables.py#L34

Cheers

Thanks for the link. I’ve been trying to work it out and unfortunately, as I’m neither good at maths or programming, I’m struggling. I’m trying to reverse engineer it so I can convert each of the 128 values to Hz.
Here’s where I’m up to - the last two entries are what are stumping me (the log related bits).
Can anyone help me out?
Thanks

sample_rate = 20000000 / 510.0 = 39215.6862745098

control_rate = sample_rate / 40.0 = 215.6862745098 / 40 = 980.3921568627451

min_frequency = 1.0 / 16.0 # Hertz = 0.0625

max_frequency = 100.0 # Hertz

excursion = 65536
num_values = 128
min_increment = excursion * min_frequency / control_rate
min_increment = 65536 * 0.0625 / 980.3921568627451 = 4.17792

max_increment = excursion * max_frequency / control_rate
max_increment = 65536 * 100 / 980.3921568627451 = 6684.672

rates = numpy.linspace(numpy.log(min_increment), numpy.log(max_increment), num_values)
rates = numpy.linspace(numpy.log(4.17792), numpy.log(6684.672), 128) <---- this is where I’m stuck

lookup_tables.append(
(‘lfo_increments’, numpy.exp(rates).astype(int))

NumPy is an addon library for Python. There are online live Python interpreters running Numpy which can help you with that. So I went here and pasted this code in there

``````import numpy

sample_rate = 20000000 / 510.0
control_rate = sample_rate / 40.0

min_frequency = 1.0 / 16.0 # Hertz = 0.0625
max_frequency = 100.0 # Hertz

excursion = 65536
num_values = 128

min_increment = excursion * min_frequency / control_rate
max_increment = excursion * max_frequency / control_rate

rates = numpy.linspace(numpy.log(min_increment), numpy.log(max_increment), num_values)

print numpy.exp(rates).astype(int)
``````

and this is what it spat out:

``````[   4    4    4    4    5    5    5    6    6    7    7    7    8    8
9    9   10   11   11   12   13   14   14   15   16   17   18   20
21   22   23   25   26   28   30   31   33   35   37   40   42   45
47   50   53   57   60   64   67   71   76   80   85   90   96  101
108  114  121  128  136  144  153  162  172  182  193  204  217  230
243  258  273  290  307  325  345  366  388  411  435  461  489  518
549  582  617  654  693  735  779  825  875  927  982 1041 1104 1170
1240 1314 1392 1476 1564 1657 1757 1862 1973 2091 2216 2349 2489 2638
2796 2963 3141 3329 3528 3739 3962 4199 4451 4717 4999 5298 5615 5951
6307 6684]
``````

That looks like increments for the LFO lookup tables. So dividing excursion by the numbers from the table, then dividing the result of that with the control rate (which is around 980 Hz), gives you these frequencies:

``````0 - 0.0598
1 - 0.0598
2 - 0.0598
3 - 0.0598
4 - 0.0748
5 - 0.0748
6 - 0.0748
7 - 0.0898
8 - 0.0898
9 - 0.1047
10 - 0.1047
11 - 0.1047
12 - 0.1197
13 - 0.1197
14 - 0.1346
15 - 0.1346
16 - 0.1496
17 - 0.1646
18 - 0.1646
19 - 0.1795
20 - 0.1945
21 - 0.2094
22 - 0.2094
23 - 0.2244
24 - 0.2394
25 - 0.2543
26 - 0.2693
27 - 0.2992
28 - 0.3142
29 - 0.3291
30 - 0.3441
31 - 0.3740
32 - 0.3889
33 - 0.4189
34 - 0.4488
35 - 0.4637
36 - 0.4937
37 - 0.5236
38 - 0.5535
39 - 0.5984
40 - 0.6283
41 - 0.6732
42 - 0.7031
43 - 0.7480
44 - 0.7929
45 - 0.8527
46 - 0.8976
47 - 0.9574
48 - 1.0023
49 - 1.0621
50 - 1.1369
51 - 1.1968
52 - 1.2716
53 - 1.3464
54 - 1.4361
55 - 1.5109
56 - 1.6156
57 - 1.7054
58 - 1.8101
59 - 1.9148
60 - 2.0345
61 - 2.1542
62 - 2.2888
63 - 2.4235
64 - 2.5731
65 - 2.7226
66 - 2.8872
67 - 3.0518
68 - 3.2462
69 - 3.4407
70 - 3.6352
71 - 3.8596
72 - 4.0840
73 - 4.3383
74 - 4.5926
75 - 4.8619
76 - 5.1611
77 - 5.4752
78 - 5.8043
79 - 6.1484
80 - 6.5074
81 - 6.8964
82 - 7.3152
83 - 7.7491
84 - 8.2128
85 - 8.7065
86 - 9.2301
87 - 9.7836
88 - 10.3670
89 - 10.9953
90 - 11.6535
91 - 12.3417
92 - 13.0896
93 - 13.8675
94 - 14.6903
95 - 15.5729
96 - 16.5154
97 - 17.5027
98 - 18.5499
99 - 19.6569
100 - 20.8238
101 - 22.0804
102 - 23.3968
103 - 24.7881
104 - 26.2840
105 - 27.8548
106 - 29.5153
107 - 31.2805
108 - 33.1505
109 - 35.1401
110 - 37.2344
111 - 39.4634
112 - 41.8270
113 - 44.3253
114 - 46.9881
115 - 49.8005
116 - 52.7775
117 - 55.9339
118 - 59.2699
119 - 62.8153
120 - 66.5852
121 - 70.5644
122 - 74.7830
123 - 79.2559
124 - 83.9981
125 - 89.0246
126 - 94.3502
127 - 99.9899``````

Thanks so much for this - exactly what I was after and I’m sure it’ll be useful for others too. You’re getting a shout out on my next release

I’m a man of my word EvilDragon - check out the credits

Thanks for the shoutout!