Calculator
Formula Used
For a signal x[n] with N samples, lag k autocorrelation is:
R[k] = sum from n = 0 to N - k - 1 of x[n] x[n + k]
Biased result: Rb[k] = R[k] / N
Unbiased result: Ru[k] = R[k] / (N - k)
Normalized coefficient: C[k] = R[k] / R[0]
Estimated pitch frequency: f = sample rate / best lag
How to Use This Calculator
Paste sample values or upload a small uncompressed WAV file.
Enter the sample rate if you paste values manually.
Choose a maximum lag in milliseconds or samples.
Set a frequency range for the pitch peak search.
Keep mean removal enabled for most real audio signals.
Press Calculate to view results above the form.
Use CSV for spreadsheets. Use PDF for quick reporting.
Example Data Table
| Sample Index | Sample Value | Signal Note |
|---|---|---|
| 0 | 0.00 | Zero crossing |
| 1 | 0.25 | Rising edge |
| 2 | 0.59 | Positive rise |
| 3 | 0.95 | Near positive peak |
| 4 | 0.59 | Falling edge |
| 5 | 0.25 | Returning toward zero |
| 6 | 0.00 | Next zero crossing |
| 7 | -0.25 | Negative edge |
Autocorrelation Audio Insight
Autocorrelation compares an audio signal with delayed copies of itself. A strong match at a later lag shows that a pattern repeats. This is useful for pitch checks, echo study, periodic noise review, and simple feature extraction. The calculator accepts pasted samples or a small uncompressed wave file. It converts the chosen data to a single sample list, then measures similarity across lags.
Why Lag Matters
A lag is a delay measured in samples. When the delay equals one period of a repeating tone, the waveform lines up again. The normalized coefficient then rises near one. If the sample rate is known, the lag can be converted into seconds. It can also estimate a frequency by dividing the sample rate by the lag.
Cleaner Results
Real audio often contains offsets, noise, and changing loudness. Mean removal helps center the waveform before calculation. Normalization makes coefficients easier to compare across signals. Biased and unbiased scaling change how each lag is divided. Raw mode shows direct sums, which can help with custom processing.
Practical Use
Keep sample lists short when testing in a browser. Long audio files need heavier signal processing tools. Start with a maximum lag that covers the slowest pattern you expect. For voice pitch, try a range from 50 Hz to 500 Hz. For musical tones, widen the upper limit. Use the strongest peak as a clue, not as proof. Harmonics, echoes, and noise can create competing peaks.
Exported Reports
CSV output is best for spreadsheet checks or charting. The PDF report is a compact summary for notes. Review the table to see how coefficients change with lag. A steady rise and fall often shows periodic structure. A flat curve usually means weak repetition. Always compare the result with the original audio context.
Limits and Checks
The method assumes evenly spaced samples. Clipped signals can distort the peak. Silence can make normalization unstable. Very low sample rates reduce frequency detail. Very short clips can miss slow cycles. Use windowed segments when audio changes over time. Compare several sections before deciding. For advanced work, combine autocorrelation with spectra, filtering, and visual waveform inspection. This balanced approach gives stronger evidence. It also helps catch false peaks early today.
FAQs
What does autocorrelation show in audio?
It shows how well a signal matches delayed copies of itself. Repeated shapes create peaks at certain lags. Those peaks can reveal pitch, echo spacing, or periodic noise.
Can this calculator estimate pitch?
Yes. It searches for the strongest normalized peak inside your frequency range. The pitch estimate is the sample rate divided by the peak lag.
Should I remove the mean?
Usually yes. Mean removal centers the waveform. It reduces DC offset effects and often makes lag peaks easier to compare.
What is biased scaling?
Biased scaling divides every lag sum by the total sample count. It keeps the same divisor across lags, which can make curves look smoother.
What is unbiased scaling?
Unbiased scaling divides by the number of overlapping sample pairs. It compensates for fewer comparisons at larger lags.
Why is my pitch result wrong?
Noise, harmonics, clipping, echoes, or a poor frequency range can shift the strongest peak. Try a cleaner segment and adjust the pitch limits.
Can I upload MP3 files?
No. This page only reads simple uncompressed WAV files. Convert compressed audio to WAV before uploading, or paste numeric samples directly.
Why limit the number of samples?
Autocorrelation uses many repeated multiplications. Large inputs can slow a shared server. The limit keeps the calculator responsive.