2 ms·
For constant frequency oscillators in code I find myself doing this: use the lowest precision acceptable then compute: t = mod( t + ts, tPeriod ); x = si
by willis936 5y ago
For constant frequency oscillators in code I find myself doing this: use the lowest precision acceptable then compute:
t = mod( t + ts, tPeriod );
x = sinpi( t * f * ts );
Maybe it's not as fast as a LUT, but I've never needed high performance and generally work with higher precision data where a LUT would be unreasonable.
MATLAB example to be more explicit:
f = double(1000);
tPeriod = 1 / f;
ts = double(1 / 48000);
t = double(0);
while true
t = mod( t + ts, tPeriod );
x = sinpi( t * f * ts );
end