Library / Signal processing and digital filters / DSP-46
Signal processing and digital filters
Rational resampling output rate
Output sampling rate after interpolating by a positive integer L and then decimating by a positive integer M, with a suitable low-pass filter.
- Ref
- DSP-46
- Rev
- v1
- Field
- Signal processing and digital filters
- Result
- fout [Hz]
Interpolating by L raises the sampling rate to L·fin, and decimating by M divides it by M, so the output rate is fin·L/M. Reduce L/M by their common factor first: converting 48 kHz to 44.1 kHz is L/M = 147/160, not 44100/48000. The low-pass filter between the two stages must remove images and prevent aliasing, and the rate alone does not show that it does.
Output sampling rate after interpolating by a positive integer L and then decimating by a positive integer M, with a suitable low-pass filter. Reduce L/M by their common factor for an efficient design. The rate alone does not show that aliasing is rejected.
Calculator
- Greatest common divisor of L and M1
- Reduced interpolation factor, L/gcd147
- Reduced decimation factor, M/gcd160
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- Resampling 48,000 Hz by 147/160 gives 44,100 Hz, a ratio of 0.91875.
- The output sample interval is 22.68 µs. The rate goes down, so the filter must cut off below the new Nyquist frequency of 22,050 Hz.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (Hz) | Local step | Change in result |
|---|---|---|---|---|---|---|
| fin Input sampling rate | 1 to 1e7 Hz | 0.9187 | 9,188,000 | 9,187,000 | +10% | +10 % |
| M Decimation factor | 1 to 1,000 | 7,056 | 7,056,000 | 7,049,000 | +1 | −0.621 % |
| L Interpolation factor | 1 to 1,000 | 300 | 300,000 | 299,700 | +1 | +0.68 % |
Sweep of Decimation factor
| Decimation factor | Output sampling rate (Hz) |
|---|---|
| 1 | 7,056,000 |
| 2.371 | 3,528,000 |
| 5.623 | 1,176,000 |
| 13.34 | 542,800 |
| 31.62 | 220,500 |
| 74.99 | 94,080 |
| 177.8 | 39,640 |
| 421.7 | 16,720 |
| 1,000 | 7,056 |
Sweep one variable
Variables and how each one contributes
Output sampling rate
What the equation gives you. Everything else feeds it.
Input sampling rate
The input sampling rate, in Hz. Scales the output rate in direct proportion. Raising it by 10 % (to 52,800) moves the result by +10 %, from 44,100 to 48,510 Hz.
Interpolation factor
The interpolation factor, a positive integer. Raises the output rate in direct proportion. Raising it by 10 % (to 161.7) moves the result by +10.2 %, from 44,100 to 48,600 Hz.
Decimation factor
The decimation factor, a positive integer. Lowers the output rate in inverse proportion. Raising it by 10 % (to 176) moves the result by −9.09 %, from 44,100 to 40,090 Hz.
Worked example with the values above
- Common factor: gcd(147, 160) = 1, so L/M reduces to 147/160.
- Ratio: L/M = 0.91875.
- f_out = 48,000 × 0.91875 = 44,100 Hz.
Assumptions and limits
- Integer, positive resampling factors, with a low-pass filter that gives enough alias rejection.
- For analytic-signal formulas, a narrowband signal with a clean quadrature component and less than π of phase change per sample.
Common mistakes
- Not reducing L/M by the common factor, which wastes computation.
- Forgetting the filter delay when counting output samples.
- Using the phase difference when the true change per sample exceeds π.
Statistics and uncertainty
Rates and lengths here are exact integer relations. Estimates of envelope and frequency from analytic samples are sensitive to noise, since the phase of a small sample is poorly defined, so use only samples well above the noise floor.
Where it is used
- Converting between audio and instrumentation sample rates and sizing buffers.
- Demodulating amplitude and frequency from complex baseband data.
Maths you need
- Interpolation and decimation: raising and lowering the sampling rate by integer factors
- Analytic signal: a real signal plus i times its Hilbert transform
- Principal phase: phase wrapped to the range −π to π