GestureSynth.me

Music calculator

DDS Tuning Word Calculator

Convert an oscillator target into the nearest integer DDS tuning word. Read hexadecimal register value, frequency step, realized frequency and signed error.

dds tuning word calculator

DDS Tuning Word Calculator guide

A digital oscillator advances a phase accumulator on each clock tick. The register usually accepts an integer increment while a patch specifies a frequency in hertz. Enter the phase accumulator width and its actual update clock to find the closest available increment.

Play the instrument ↑
Default result
2048 tuning word

Calculation and units

An accumulator with B bits wraps after 2 to the power B phase counts. One tuning-word count therefore represents clock divided by 2 to the power B hertz. Divide the target by this step and round to the nearest whole count, with exact positive half steps rounding upward.

Worked examples

Select a named case in the Worked example control to load these values. You can then edit any input to compare the result.

Exact binary fraction

Accumulator clock (Hz) = 48000 · Target frequency (Hz) = 1500 · Accumulator width (bits) = 16.

2048 tuning word. 0x0800 · realized frequency 1500 Hz · signed error 0 Hz · frequency step 0.732421875 Hz per count.

An integer number of phase steps represents this pitch exactly. It makes a useful control when reviewing a tuning table generated for another clock.

Concert A on a short accumulator

Accumulator clock (Hz) = 48000 · Target frequency (Hz) = 440 · Accumulator width (bits) = 12.

38 tuning word. 0x026 · realized frequency 445.3125 Hz · signed error 5.3125 Hz · frequency step 11.71875 Hz per count.

With fewer phase states the closest available pitch may differ audibly. The signed error tells which side of the requested pitch the oscillator lands on.

Concert A with more bits

Accumulator clock (Hz) = 48000 · Target frequency (Hz) = 440 · Accumulator width (bits) = 24.

153791 tuning word. 0x0258BF · realized frequency 439.999580383 Hz · signed error -0.000419617 Hz · frequency step 0.002861022949 Hz per count.

Use the preceding setting as a comparison. Increasing the accumulator width shrinks the frequency increment without changing the clock driving the lookup.

Very low modulation rate

Accumulator clock (Hz) = 48000 · Target frequency (Hz) = 0.1 · Accumulator width (bits) = 16.

0 tuning word. 0x0000 · realized frequency 0 Hz · signed error -0.1 Hz · frequency step 0.732421875 Hz per count.

The target falls below half of one frequency increment. If the register rounds to zero, the oscillator holds its phase instead of completing a slow cycle.

Stationary phase reference

Accumulator clock (Hz) = 48000 · Target frequency (Hz) = 0 · Accumulator width (bits) = 16.

0 tuning word. 0x0000 · realized frequency 0 Hz · signed error 0 Hz · frequency step 0.732421875 Hz per count.

A zero increment keeps the lookup address constant. The output level depends on initial phase and table contents even though the reported frequency is zero.

Quarter-rate tone

Accumulator clock (Hz) = 96000 · Target frequency (Hz) = 24000 · Accumulator width (bits) = 32.

1073741824 tuning word. 0x40000000 · realized frequency 24000 Hz · signed error 0 Hz · frequency step 0.000022351742 Hz per count.

A quarter of the reference clock advances the accumulator by a quarter circle every tick. Only four phase positions recur in this idealized example.

Interpreting the result

Check the realized frequency before copying the hexadecimal result. On a short accumulator, a tuning table can map several neighboring targets to the same word. A positive signed error means the nearest representable oscillator runs above the target.

Measurement and model limits

The clock is the accumulator update rate, which may differ from a processor clock or audio interface sample rate. The tool covers unsigned baseband increments through half the clock. Lookup-table truncation, DAC images, clock tolerances and output filtering affect a physical generator.

Answers before you play

Common questions

Is the table address width the same as B?

Use the full phase accumulator width, even when only its upper bits address the waveform table. The two widths serve different purposes.

What happens if the word is zero?

Phase stops advancing. A lookup oscillator then reads a constant value selected by the starting phase.

Does doubling the clock improve resolution?

With a fixed accumulator width it doubles the frequency increment. More phase bits can restore fine spacing while preserving the higher clock.

Is the word already in byte transmission order?

It is displayed as a hexadecimal number. The device data sheet determines byte order, register segmentation and any control bits during programming.