Generate accurate sine tables for any angular range, step size, and precision. Visualize the sine waveform with sampled points.
A sine lookup table (LUT) precomputes values of the sine function over a discrete set of angles. This technique is fundamental in real-time embedded systems, digital oscillators, motor control, and graphics where computational cost of trigonometric functions must be minimized. The table trades a small amount of memory for deterministic, high-speed execution — often 10–100x faster than calling sin() on low-end microcontrollers.
Double-precision floating point provides ~15 decimal digits of accuracy. When generating fixed-point LUTs (e.g., Q15 format for DSP), you can scale the output. This generator allows up to 8 decimal places, sufficient for high-fidelity audio synthesis or control loops. For embedded usage, truncation to 16-bit integers is common: int16_t sin_value = round(sin(angle) * 32767).
Math.sin function (IEEE 754 double precision). Known test points: sin(30°)=0.5, sin(90°)=1, sin(0°)=0. Any discrepancy < 1e-15 is due to floating-point rounding. Cross‑check any row with a trusted reference (Wolfram Alpha, GNU Octave, or a certified math library).
The maximum interpolation error for a sine table is approximately (Δθ)² / 8 for the second-order Taylor bound. For Δθ = 1° (π/180 rad), worst-case error ~0.00015; for Δθ = 5°, error ~0.0038. Trade memory footprint for precision — this tool helps you design optimal tables.
A polyphonic synthesizer engine requires 48 kHz sample rate and 16 voices. Computing sin() on an ARM Cortex-M4 in real time is possible but costly. Using a 256-entry sine LUT (0°–360°, step 1.406°) with linear interpolation reduces CPU load by ~85% while maintaining THD below -80dB. This generator can produce that exact table for direct integration into C/C++ header files.
sin() call ~520 cycles, LUT with linear interpolation ~80 cycles. 85% reduction, enabling 16‑voice polyphony at 48 kHz.
Modern lookup tables often combined with small interpolation or Taylor expansion. The method used here is direct evaluation of the standard math library sin() using the system's floating-point unit – ideal for prototyping. For resource-constrained MCUs, precomputed tables are then transferred into ROM. Our CSV export can be directly imported into Python, MATLAB, or embedded build systems.
const float sin_table[] = { ... };. Most code editors support column editing. You can also post-process the CSV with a script.
Math.sin, which conforms to the IEEE 754 standard (ECMAScript specification). You can cross‑check any row against known values (e.g., sin(30°)=0.5, sin(π/2)=1). The tool also displays min/max statistics to detect anomalies. For critical systems, we recommend verifying with a secondary source such as Wolfram Alpha or a certified math library.