pvx Window Reference

May 25, 2026 · View on GitHub

pvx logo

pvx Window Reference

Generated from commit dff2a4f (commit date: 2026-04-21T21:20:38-04:00).

pvx currently supports 50 analysis windows. This file defines each one mathematically and explains it in plain English.

Notation

  • Window length: NN
  • Sample index: n{0,,N1}n \in \{0,\dots,N-1\}
  • Center index: m=(N1)/2m=(N-1)/2
  • Normalized center coordinate: xn=(nm)/mx_n=(n-m)/m

Formula Key

(W0) Rectangular

w[n]=1w[n]=1

(W1) Cosine series

w[n]=k=0Kakcos(2πknN1)w[n]=\sum_{k=0}^{K} a_k\cos\left(\frac{2\pi k n}{N-1}\right)

(W2) Sine/Cosine

w[n]=sin(πnN1)w[n]=\sin\left(\frac{\pi n}{N-1}\right)

(W3) Bartlett

w[n]=1nmmw[n]=1-\left|\frac{n-m}{m}\right|

(W4) Triangular

w[n]=max(1nm(N+1)/2,0)w[n]=\max\left(1-\left|\frac{n-m}{(N+1)/2}\right|,0\right)

(W5) Bartlett-Hann

x=nN112,w[n]=0.620.48x+0.38cos(2πx)x=\frac{n}{N-1}-\frac{1}{2},\quad w[n]=0.62-0.48|x|+0.38\cos(2\pi x)

(W6) Tukey

x=nN1,w[n]={12(1+cos(π(2xα1))),0x<α21,α2x<1α212(1+cos(π(2xα2α+1))),1α2x1x=\frac{n}{N-1},\quad w[n]=\begin{cases} \frac{1}{2}\left(1+\cos\left(\pi\left(\frac{2x}{\alpha}-1\right)\right)\right), & 0\le x<\frac{\alpha}{2} \\ 1, & \frac{\alpha}{2}\le x<1-\frac{\alpha}{2} \\ \frac{1}{2}\left(1+\cos\left(\pi\left(\frac{2x}{\alpha}-\frac{2}{\alpha}+1\right)\right)\right), & 1-\frac{\alpha}{2}\le x\le 1 \end{cases}

Special cases in pvx: α0\alpha\le 0 gives rectangular behavior, and α1\alpha\ge 1 collapses to Hann.

(W7) Parzen

u=2nN11,w[n]={16u2+6u3,0u122(1u)3,12<u10,u>1u=\left|\frac{2n}{N-1}-1\right|,\quad w[n]=\begin{cases} 1-6u^2+6u^3, & 0\le u\le \frac{1}{2} \\ 2(1-u)^3, & \frac{1}{2}<u\le 1 \\ 0, & u>1 \end{cases}

(W8) Lanczos

w[n]=sinc(2nN11)w[n]=\mathrm{sinc}\left(\frac{2n}{N-1}-1\right)

(W9) Welch

w[n]=max(1xn2,0)w[n]=\max\left(1-x_n^2,0\right)

(W10) Gaussian

w[n]=exp(12(nmσ)2),σ=rσmw[n]=\exp\left(-\frac{1}{2}\left(\frac{n-m}{\sigma}\right)^2\right),\quad \sigma=r_\sigma m

(W11) General Gaussian

w[n]=exp(12nmσ2p)w[n]=\exp\left(-\frac{1}{2}\left|\frac{n-m}{\sigma}\right|^{2p}\right)

(W12) Exponential

w[n]=exp(nmτ),τ=rτmw[n]=\exp\left(-\frac{|n-m|}{\tau}\right),\quad \tau=r_\tau m

(W13) Cauchy

w[n]=11+(nmγ)2,γ=rγmw[n]=\frac{1}{1+\left(\frac{n-m}{\gamma}\right)^2},\quad \gamma=r_\gamma m

(W14) Cosine power

w[n]=sin(πnN1)pw[n]=\sin\left(\frac{\pi n}{N-1}\right)^p

(W15) Hann-Poisson

w[n]=wHann[n]exp(αnmm)w[n]=w_{\text{Hann}}[n]\exp\left(-\alpha\frac{|n-m|}{m}\right)

(W16) General Hamming

w[n]=α(1α)cos(2πnN1)w[n]=\alpha-(1-\alpha)\cos\left(\frac{2\pi n}{N-1}\right)

(W17) Bohman

x=2nN11,w[n]=(1x)cos(πx)+sin(πx)πx=\left|\frac{2n}{N-1}-1\right|,\quad w[n]=(1-x)\cos(\pi x)+\frac{\sin(\pi x)}{\pi}

(W18) Kaiser-Bessel

w[n]=I0(β1rn2)I0(β),rn=nmmw[n]=\frac{I_0\left(\beta\sqrt{1-r_n^2}\right)}{I_0(\beta)},\quad r_n=\frac{n-m}{m}

Each supported pvx window maps to one of the formula families above with the per-window constants shown below.

Quantitative Metrics

  • Coherent gain: CG=1Nn=0N1w[n]CG=\frac{1}{N}\sum_{n=0}^{N-1}w[n]
  • Equivalent noise bandwidth (bins): ENBW=Nnw[n]2(nw[n])2ENBW=\frac{N\sum_n w[n]^2}{(\sum_n w[n])^2}
  • Scalloping loss (dB): response ratio at a half-bin sinusoid offset
  • Main-lobe width (bins): measured from the first post-DC local minimum in zero-padded FFT magnitude
  • Peak sidelobe (dB): maximum sidelobe level outside the main lobe

Complete Window Catalog

WindowFamilyParametersFormulaCoherent gainENBW (bins)Scalloping loss (dB)Main-lobe width (bins)Peak sidelobe (dB)PlotsProsConsUsage advice
hannCosine seriescoeffs=(0.5, -0.5)W10.4997561.500733-1.4224.000-31.468time / freqBalanced leakage suppression and frequency resolution.Not optimal for amplitude metering or extreme sidelobe rejection.Default choice for most pvx time-stretch and pitch-shift workflows.
hammingCosine seriescoeffs=(0.54, -0.46)W10.5397751.363305-1.7504.000-42.675time / freqBalanced leakage suppression and frequency resolution.Not optimal for amplitude metering or extreme sidelobe rejection.Default choice for most pvx time-stretch and pitch-shift workflows.
blackmanCosine seriescoeffs=(0.42, -0.5, 0.08)W10.4197951.727601-1.0986.000-58.109time / freqStrong sidelobe suppression for cleaner spectral separation.Wider main lobe than Hann/Hamming.Use for dense harmonic material when leakage artifacts dominate.
blackmanharrisCosine seriescoeffs=(0.35875, -0.48829, 0.14128, -0.01168)W10.3585752.005332-0.8258.000-92.011time / freqStrong sidelobe suppression for cleaner spectral separation.Wider main lobe than Hann/Hamming.Use for dense harmonic material when leakage artifacts dominate.
nuttallCosine seriescoeffs=(0.355768, -0.487396, 0.144232, -0.012604)W10.3555942.022220-0.8118.000-93.325time / freqStrong sidelobe suppression for cleaner spectral separation.Wider main lobe than Hann/Hamming.Use for dense harmonic material when leakage artifacts dominate.
flattopCosine seriescoeffs=(1, -1.93, 1.29, -0.388, 0.0322)W10.9995143.772117-0.01610.000-68.311time / freqVery accurate amplitude estimation in FFT bins.Very wide main lobe and reduced frequency discrimination.Use for measurement-grade magnitude tracking, not fine pitch separation.
blackman_nuttallCosine seriescoeffs=(0.363582, -0.489177, 0.1366, -0.0106411)W10.3634051.977073-0.8508.000-98.174time / freqStrong sidelobe suppression for cleaner spectral separation.Wider main lobe than Hann/Hamming.Use for dense harmonic material when leakage artifacts dominate.
exact_blackmanCosine seriescoeffs=(0.426591, -0.496561, 0.0768487)W10.4263861.694500-1.1496.000-68.236time / freqStrong sidelobe suppression for cleaner spectral separation.Wider main lobe than Hann/Hamming.Use for dense harmonic material when leakage artifacts dominate.
sineSinusoidalnoneW20.6363091.234304-2.0963.000-22.999time / freqSmooth endpoint behavior and straightforward implementation.Less configurable than Kaiser/Tukey families.Use for stable, low-complexity alternatives to Hann.
bartlettTriangularnoneW30.4997561.333985-1.8224.000-26.523time / freqCheap linear taper with intuitive behavior.Higher sidelobes than stronger cosine-sum windows.Use for low-cost processing or quick exploratory runs.
boxcarRectangularnoneW01.0000001.000000-3.9222.000-13.264time / freqNarrowest main lobe and maximal bin sharpness.Highest sidelobes and strongest leakage/phasiness on non-bin-centered content.Use only for controlled test tones or when leakage is acceptable.
triangularTriangularnoneW40.5002441.332683-1.8264.000-26.523time / freqCheap linear taper with intuitive behavior.Higher sidelobes than stronger cosine-sum windows.Use for low-cost processing or quick exploratory runs.
bartlett_hannHybrid taperfixed coefficientsW50.4997561.456559-1.5174.000-35.874time / freqModerate leakage suppression with lightweight computation.Less common and less interpretable than standard Hann/Hamming.Use as a middle-ground taper when Bartlett feels too sharp.
tukeyTukeyalpha=0.5W60.7496341.222819-2.2362.656-15.123time / freqInterpolates between rectangular and Hann behavior.Behavior changes strongly with alpha and can be inconsistent across presets.Use when you need a controllable flat center with soft edges.
tukey_0p1Tukeyalpha=0.1W60.9495361.039289-3.5052.094-13.309time / freqInterpolates between rectangular and Hann behavior.Behavior changes strongly with alpha and can be inconsistent across presets.Use when you need a controllable flat center with soft edges.
tukey_0p25Tukeyalpha=0.25W60.8745731.102579-2.9602.281-13.601time / freqInterpolates between rectangular and Hann behavior.Behavior changes strongly with alpha and can be inconsistent across presets.Use when you need a controllable flat center with soft edges.
tukey_0p75Tukeyalpha=0.75W60.6246951.360664-1.7283.188-19.395time / freqInterpolates between rectangular and Hann behavior.Behavior changes strongly with alpha and can be inconsistent across presets.Use when you need a controllable flat center with soft edges.
tukey_0p9Tukeyalpha=0.9W60.5497311.446988-1.5213.625-24.972time / freqInterpolates between rectangular and Hann behavior.Behavior changes strongly with alpha and can be inconsistent across presets.Use when you need a controllable flat center with soft edges.
parzenPolynomialpiecewise cubicW70.3748171.918397-0.8978.000-53.046time / freqSmooth high-order taper with good sidelobe control.Broader main lobe than lightweight windows.Use for spectral denoising/analysis where sidelobe cleanup is critical.
lanczosSincnoneW80.5892021.299668-1.8893.281-26.405time / freqSinc-derived shape with useful compromise behavior.Can exhibit oscillatory spectral behavior versus cosine-sum defaults.Use for interpolation-adjacent analysis experiments.
welchQuadraticnoneW90.6663411.200587-2.2232.875-21.295time / freqCenter-emphasizing parabola with simple form.Not as strong at sidelobe suppression as Blackman-family windows.Use when center weighting is desired with minimal complexity.
gaussian_0p25Gaussiansigma_ratio=0.25W100.3131562.258144-0.66811.406-87.677time / freqSmooth bell taper with low ringing and predictable decay.Frequency resolution changes noticeably with sigma.Use sigma presets to tune transient locality versus spectral leakage.
gaussian_0p35Gaussiansigma_ratio=0.35W100.4365801.626488-1.2686.719-52.077time / freqSmooth bell taper with low ringing and predictable decay.Frequency resolution changes noticeably with sigma.Use sigma presets to tune transient locality versus spectral leakage.
gaussian_0p45Gaussiansigma_ratio=0.45W100.5489491.320556-1.8694.125-35.366time / freqSmooth bell taper with low ringing and predictable decay.Frequency resolution changes noticeably with sigma.Use sigma presets to tune transient locality versus spectral leakage.
gaussian_0p55Gaussiansigma_ratio=0.55W100.6415151.171861-2.3503.000-28.906time / freqSmooth bell taper with low ringing and predictable decay.Frequency resolution changes noticeably with sigma.Use sigma presets to tune transient locality versus spectral leakage.
gaussian_0p65Gaussiansigma_ratio=0.65W100.7134901.097657-2.7052.625-22.575time / freqSmooth bell taper with low ringing and predictable decay.Frequency resolution changes noticeably with sigma.Use sigma presets to tune transient locality versus spectral leakage.
general_gaussian_1p5_0p35Generalized Gaussianpower=1.5, sigma_ratio=0.35W110.3935872.016584-0.7845.156-24.895time / freqAdditional shape control beyond standard Gaussian.Extra parameterization increases tuning complexity.Use for research/tuning tasks where shoulder steepness matters.
general_gaussian_2p0_0p35Generalized Gaussianpower=2, sigma_ratio=0.35W110.3770812.230016-0.6335.281-19.717time / freqAdditional shape control beyond standard Gaussian.Extra parameterization increases tuning complexity.Use for research/tuning tasks where shoulder steepness matters.
general_gaussian_3p0_0p35Generalized Gaussianpower=3, sigma_ratio=0.35W110.3642872.445593-0.5325.469-16.299time / freqAdditional shape control beyond standard Gaussian.Extra parameterization increases tuning complexity.Use for research/tuning tasks where shoulder steepness matters.
general_gaussian_4p0_0p35Generalized Gaussianpower=4, sigma_ratio=0.35W110.3592672.552433-0.4965.562-15.060time / freqAdditional shape control beyond standard Gaussian.Extra parameterization increases tuning complexity.Use for research/tuning tasks where shoulder steepness matters.
exponential_0p25Exponentialtau_ratio=0.25W120.2453102.075492-1.02215.562-31.885time / freqSimple edge decay with fast computation.Can produce less-uniform center weighting than cosine families.Use for experiments emphasizing center-heavy weighting.
exponential_0p5Exponentialtau_ratio=0.5W120.4321871.313323-2.0323.625-19.190time / freqSimple edge decay with fast computation.Can produce less-uniform center weighting than cosine families.Use for experiments emphasizing center-heavy weighting.
exponential_1p0Exponentialtau_ratio=1W120.6319911.082055-2.8542.594-20.141time / freqSimple edge decay with fast computation.Can produce less-uniform center weighting than cosine families.Use for experiments emphasizing center-heavy weighting.
cauchy_0p5Cauchy / Lorentziangamma_ratio=0.5W130.5534021.229775-2.2093.562-22.733time / freqHeavy tails preserve more peripheral samples than Gaussian.Tail energy can increase leakage relative to steeper tapers.Use when you want softer attenuation of far-window samples.
cauchy_1p0Cauchy / Lorentziangamma_ratio=1W130.7852591.041963-3.1082.375-19.034time / freqHeavy tails preserve more peripheral samples than Gaussian.Tail energy can increase leakage relative to steeper tapers.Use when you want softer attenuation of far-window samples.
cauchy_2p0Cauchy / Lorentziangamma_ratio=2W130.9272331.004393-3.6482.094-14.689time / freqHeavy tails preserve more peripheral samples than Gaussian.Tail energy can increase leakage relative to steeper tapers.Use when you want softer attenuation of far-window samples.
cosine_power_2Cosine powerpower=2W140.4997561.500733-1.4224.000-31.468time / freqSimple power parameter controls edge steepness.Higher powers can overly narrow effective support.Use to smoothly increase edge attenuation versus basic sine.
cosine_power_3Cosine powerpower=3W140.4242061.735739-1.0745.000-39.295time / freqSimple power parameter controls edge steepness.Higher powers can overly narrow effective support.Use to smoothly increase edge attenuation versus basic sine.
cosine_power_4Cosine powerpower=4W140.3748171.945394-0.8626.000-46.741time / freqSimple power parameter controls edge steepness.Higher powers can overly narrow effective support.Use to smoothly increase edge attenuation versus basic sine.
hann_poisson_0p5Hann-Poissonalpha=0.5W150.4329461.609944-1.2585.188-35.245time / freqCombines smooth Hann center with exponential edge suppression.Can over-attenuate edges for high alpha values.Use when you need stronger edge decay than Hann without full flattop cost.
hann_poisson_1p0Hann-Poissonalpha=1W150.3787971.734176-1.112103.750-80.017time / freqCombines smooth Hann center with exponential edge suppression.Can over-attenuate edges for high alpha values.Use when you need stronger edge decay than Hann without full flattop cost.
hann_poisson_2p0Hann-Poissonalpha=2W150.2978782.023174-0.870164.719-80.005time / freqCombines smooth Hann center with exponential edge suppression.Can over-attenuate edges for high alpha values.Use when you need stronger edge decay than Hann without full flattop cost.
general_hamming_0p50General Hammingalpha=0.50W160.4997561.500733-1.4224.000-31.468time / freqTunable Hamming-style cosine weighting.Less standardized than classic Hann/Hamming choices.Use to sweep sidelobe-vs-width behavior near Hamming family defaults.
general_hamming_0p60General Hammingalpha=0.60W160.5998051.222475-2.1793.469-31.600time / freqTunable Hamming-style cosine weighting.Less standardized than classic Hann/Hamming choices.Use to sweep sidelobe-vs-width behavior near Hamming family defaults.
general_hamming_0p70General Hammingalpha=0.70W160.6998541.091920-2.7622.656-24.078time / freqTunable Hamming-style cosine weighting.Less standardized than classic Hann/Hamming choices.Use to sweep sidelobe-vs-width behavior near Hamming family defaults.
general_hamming_0p80General Hammingalpha=0.80W160.7999021.031273-3.2272.312-18.649time / freqTunable Hamming-style cosine weighting.Less standardized than classic Hann/Hamming choices.Use to sweep sidelobe-vs-width behavior near Hamming family defaults.
bohmanBohmannoneW170.4050871.786613-1.0226.000-45.997time / freqContinuous-slope taper with good qualitative leakage control.Less common in audio tooling and harder to tune by intuition.Use for exploratory spectral work needing smooth derivatives.
cosineSinusoidalnoneW20.6363091.234304-2.0963.000-22.999time / freqSmooth endpoint behavior and straightforward implementation.Less configurable than Kaiser/Tukey families.Use for stable, low-complexity alternatives to Hann.
kaiserKaiser-Besselbeta from --kaiser-betaW180.3317082.162181-0.7129.125-105.921time / freqContinuously tunable width/sidelobe tradeoff via beta.Needs beta tuning; poor beta choices can over-blur or under-suppress sidelobes.Use when you need explicit control over leakage versus resolution.
rectRectangularnoneW01.0000001.000000-3.9222.000-13.264time / freqNarrowest main lobe and maximal bin sharpness.Highest sidelobes and strongest leakage/phasiness on non-bin-centered content.Use only for controlled test tones or when leakage is acceptable.
WindowTime-domain shapeMagnitude spectrum
hannhann timehann freq
hamminghamming timehamming freq
blackmanblackman timeblackman freq
blackmanharrisblackmanharris timeblackmanharris freq
nuttallnuttall timenuttall freq
flattopflattop timeflattop freq
blackman_nuttallblackman_nuttall timeblackman_nuttall freq
exact_blackmanexact_blackman timeexact_blackman freq
sinesine timesine freq
bartlettbartlett timebartlett freq
boxcarboxcar timeboxcar freq
triangulartriangular timetriangular freq
bartlett_hannbartlett_hann timebartlett_hann freq
tukeytukey timetukey freq
tukey_0p1tukey_0p1 timetukey_0p1 freq
tukey_0p25tukey_0p25 timetukey_0p25 freq
tukey_0p75tukey_0p75 timetukey_0p75 freq
tukey_0p9tukey_0p9 timetukey_0p9 freq
parzenparzen timeparzen freq
lanczoslanczos timelanczos freq
welchwelch timewelch freq
gaussian_0p25gaussian_0p25 timegaussian_0p25 freq
gaussian_0p35gaussian_0p35 timegaussian_0p35 freq
gaussian_0p45gaussian_0p45 timegaussian_0p45 freq
gaussian_0p55gaussian_0p55 timegaussian_0p55 freq
gaussian_0p65gaussian_0p65 timegaussian_0p65 freq
general_gaussian_1p5_0p35general_gaussian_1p5_0p35 timegeneral_gaussian_1p5_0p35 freq
general_gaussian_2p0_0p35general_gaussian_2p0_0p35 timegeneral_gaussian_2p0_0p35 freq
general_gaussian_3p0_0p35general_gaussian_3p0_0p35 timegeneral_gaussian_3p0_0p35 freq
general_gaussian_4p0_0p35general_gaussian_4p0_0p35 timegeneral_gaussian_4p0_0p35 freq
exponential_0p25exponential_0p25 timeexponential_0p25 freq
exponential_0p5exponential_0p5 timeexponential_0p5 freq
exponential_1p0exponential_1p0 timeexponential_1p0 freq
cauchy_0p5cauchy_0p5 timecauchy_0p5 freq
cauchy_1p0cauchy_1p0 timecauchy_1p0 freq
cauchy_2p0cauchy_2p0 timecauchy_2p0 freq
cosine_power_2cosine_power_2 timecosine_power_2 freq
cosine_power_3cosine_power_3 timecosine_power_3 freq
cosine_power_4cosine_power_4 timecosine_power_4 freq
hann_poisson_0p5hann_poisson_0p5 timehann_poisson_0p5 freq
hann_poisson_1p0hann_poisson_1p0 timehann_poisson_1p0 freq
hann_poisson_2p0hann_poisson_2p0 timehann_poisson_2p0 freq
general_hamming_0p50general_hamming_0p50 timegeneral_hamming_0p50 freq
general_hamming_0p60general_hamming_0p60 timegeneral_hamming_0p60 freq
general_hamming_0p70general_hamming_0p70 timegeneral_hamming_0p70 freq
general_hamming_0p80general_hamming_0p80 timegeneral_hamming_0p80 freq
bohmanbohman timebohman freq
cosinecosine timecosine freq
kaiserkaiser timekaiser freq
rectrect timerect freq

Practical Selection Guidance

  • Use hann or hamming for balanced everyday phase-vocoder work.
  • Use kaiser when you need explicit sidelobe control with --kaiser-beta.
  • Use flattop for amplitude-accuracy-focused spectral measurement.
  • Use tukey_* when you want a controllable flat center region.
  • Use Gaussian/Cauchy/Exponential families to experiment with edge-decay shape and time-locality.

Attribution

See ATTRIBUTION.md.