GestureSynth.me

Music calculator

Circular Convolution Calculator

Calculate N-point circular convolution of two real lists. See each output index, the sum and how much of the linear tail wraps around.

circular convolution calculator

Circular Convolution Calculator guide

Circular convolution treats index positions as a repeating loop of N samples. Enter two real sequences beginning at index zero and choose a period at least as long as the longer list. Short lists are extended with zeros through that period. The output always has exactly N rows.

Play the instrument ↑
Default result
3 circular samples

Calculation and units

Multiply each input value by every kernel value. Add the product to the position given by the sum of their indexes modulo N. Equivalently, compute the full linear convolution and add each value beyond the period back into the corresponding earlier slot. The reported tail count describes positions even if some of their actual values happen to be zero.

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.

Tail folds into zero

Input sequence x = 1 2 3 · Kernel h = 1 -1 · Period N (samples) = 3.

3 circular samples. First sample -2. Linear length 4. 1 linear tail positions wrap into the start of the period. Output sum 0. Table readings (Index, Circular output): (0, -2) / (1, 1) / (2, 1).

The final linear term is minus three. It folds onto the first value of one to give minus two at circular index zero.

Long enough for the tail

Input sequence x = 1 2 3 · Kernel h = 1 -1 · Period N (samples) = 4.

4 circular samples. First sample 1. Linear length 4. 0 linear tail positions wrap into the start of the period. Output sum 0. Table readings (Index, Circular output): (0, 1) / (1, 1) / (2, 1) / (3, -3).

Increasing the period by one gives every linear output position its own slot. The last negative sample remains at the end.

One step rotation

Input sequence x = 2 4 6 8 · Kernel h = 0 1 · Period N (samples) = 4.

4 circular samples. First sample 8. Linear length 5. 1 linear tail positions wrap into the start of the period. Output sum 20. Table readings (Index, Circular output): (0, 8) / (1, 2) / (2, 4) / (3, 6).

A unit impulse delayed by one position rotates the record. The value formerly at the last index appears first.

Circular moving average

Input sequence x = 2 4 6 8 · Kernel h = 0.5 0.5 · Period N (samples) = 4.

4 circular samples. First sample 5. Linear length 5. 1 linear tail positions wrap into the start of the period. Output sum 20. Table readings (Index, Circular output): (0, 5) / (1, 3) / (2, 5) / (3, 7).

The first average uses the last input as its neighbor. This boundary behavior is appropriate for an intentionally repeated loop.

Unequal short lists

Input sequence x = 1 2 · Kernel h = 3 4 5 · Period N (samples) = 5.

5 circular samples. First sample 3. Linear length 4. 0 linear tail positions wrap into the start of the period. Output sum 36. Table readings (Index, Circular output): (0, 3) / (1, 10) / (2, 13) / (3, 10) / (4, 0).

Each short list receives zeros through the selected period. One final zero remains beyond the end of the full linear output.

One sample period

Input sequence x = 3 · Kernel h = -2 · Period N (samples) = 1.

1 circular samples. First sample -6. Linear length 1. 0 linear tail positions wrap into the start of the period. Output sum -6. Table readings (Index, Circular output): (0, -6).

The shortest possible product has only one destination. Its value is the ordinary scalar product and its index is zero.

Interpreting the result

To diagnose a difference from linear filtering, first choose a period equal to the combined input lengths minus one. Inspect the tail and reduce the period by one. The former last term now adds to index zero. This simple experiment shows how unwanted wraparound appears when a frequency-domain filtering block is too short.

Measurement and model limits

The calculator works on real finite lists with a common time step. It preserves index origin and uses no window or Fourier normalization. An FFT-based implementation can produce the same sequence by multiplying equal-length forward transforms and applying a properly scaled inverse transform. Floating-point rounding can affect the last displayed digits.

Answers before you play

Common questions

Can the two lists have different lengths?

Yes. Zero extension happens independently for each list. The chosen period must accommodate both inputs.

Why does the tool reject a period shorter than one list?

Truncation and folding of an input are different operations. Explicitly prepare one period of the intended input before entering it.

How can I verify the output sum?

Multiply the sum of the first list by the sum of the second. Each pairwise product appears once somewhere in the circular output.

How do I model a loop delay?

Put a unit impulse at the desired offset in the kernel. Values shifted beyond the period return at the start of the output.