{{Short description|Changing the sampling rate of a discrete signal}} {{refimprove|date=April 2011}}

'''Sample-rate conversion''', '''sampling-frequency conversion''' or '''resampling''' is the process of changing the sampling rate or sampling frequency of a discrete signal to obtain a new discrete representation of the underlying continuous signal.<ref name="Oppenheim-1999"/> Application areas include image scaling<ref name="Lyons-2010"/> and audio/visual systems, where different sampling rates may be used for engineering, economic, or historical reasons.

For example, Compact Disc Digital Audio and Digital Audio Tape systems use different sampling rates, and American television, European television, and movies all use different frame rates. Sample-rate conversion prevents changes in speed and pitch that would otherwise occur when transferring recorded material between such systems.

More specific types of resampling include: ''upsampling'' or ''upscaling''; ''downsampling'', ''downscaling'', or ''decimation''; and ''interpolation''. The term '''multi-rate digital signal processing''' is sometimes used to refer to systems that incorporate sample-rate conversion.

== Techniques == Conceptual approaches to sample-rate conversion include: converting to an analog continuous signal, then resampling at the new rate, or calculating the values of the new samples directly from the old samples. The latter approach is more satisfactory since it introduces less noise and distortion.<ref name="Antoniou-2006"/> Two possible implementation methods are as follows: # If the ratio of the two sample rates is (or can be approximated by){{efn-ua |For example, the irrational ratio 2<sup>1/12</sup>, corresponding to one equal-temperament semitone, might be approximated by 196/185 (roughly 0.99994 semitones). }}<ref name="Partch-2009"/> a fixed rational number ''L''/''M'': generate an intermediate signal by inserting ''L'' − 1 zeros between each of the original samples. Low-pass filter this signal at half of the lower of the two rates. Select every ''M''-th sample from the filtered output to obtain the result.<ref name="Rajamani-2000"/> # Treat the samples as geometric points and create any needed new points by interpolation. Choosing an interpolation method is a trade-off between implementation complexity and conversion quality (according to application requirements). Commonly used are: zero-order hold (for film/video frames), cubic (for image processing) and windowed sinc function (for audio).

The two methods are mathematically identical: picking an interpolation function in the second scheme is equivalent to picking the impulse response of the filter in the first scheme. Linear interpolation is equivalent to a triangular impulse response; windowed sinc approximates a brick-wall filter (it approaches the desirable brick-wall filter as the number of points increases). The length of the impulse response of the filter in method 1 corresponds to the number of points used in interpolation in method 2.

In method 1, a slow pre-computation (such as the Remez algorithm) can be used to obtain an optimal (per application requirements) filter design. Method 2 will work in more general cases, e.g., where the ratio of sample rates is not rational, or two real-time streams must be accommodated, or the sample rates are time-varying.

See decimation and upsampling for further information on sample-rate conversion filter design/implementation.

== Examples == === Film and television === The slow-scan TV signals from the Apollo Moon missions were converted to the conventional TV rates for the viewers at home. Digital interpolation schemes were not practical at that time, so analog conversion was used. This was based on a TV rate camera viewing a monitor displaying the Apollo slow-scan images.<ref name="Bill Wood-2005"/>

Movies (shot at 24 frames per second) are converted to television (roughly 50 or 60 fields{{efn-ua |A field is half of an interlaced frame &ndash; just the odd or even lines. }} per second). To convert a 24-frame/second movie to 60-field/second television, for example, alternate movie frames are shown 2 and 3 times, respectively. For 50&nbsp;Hz systems such as PAL, each frame is shown twice. Since 50 is not exactly {{times|2×24}}, the movie will run 50&nbsp;/ 48&nbsp;= 4% faster, and the audio pitch will be 4% higher, an effect known as PAL speed-up. This is often accepted for simplicity, but more complex methods are possible that preserve the running time and pitch. Every twelfth frame can be repeated 3 times rather than twice, or digital interpolation (see above) can be used in a video scaler.

=== Audio === Audio on Compact Disc has a sampling rate of 44.1&nbsp;kHz; to transfer it to a digital medium that uses 48&nbsp;kHz, method 1 above can be used with ''L''&nbsp;= 160, ''M''&nbsp;= 147 (since 48000&nbsp;/ 44100&nbsp;= 160&nbsp;/ 147).<ref name="Rajamani-2000"/> For the reverse conversion, the values of ''L'' and ''M'' are swapped. Per above, in both cases, the low-pass filter should be set to 22.05&nbsp;kHz.

=== Operating systems === Microsoft Windows and Android are examples of operating systems that perform sample-rate conversion.<ref>{{Cite web |title=Sample rate conversion {{!}} Android Open Source Project |url=https://source.android.com/docs/core/audio/src |archive-url=http://web.archive.org/web/20260121142146/https://source.android.com/docs/core/audio/src |archive-date=2026-01-21 |access-date=2026-03-15 |website=Android Open Source Project |language=en}}</ref><ref>{{Cite web |last=drewbatgit |title=About WASAPI - Win32 apps |url=https://learn.microsoft.com/en-us/windows/win32/coreaudio/wasapi |access-date=2026-03-15 |website=learn.microsoft.com |language=en-us}}</ref>

=== Media players === Many media player software (such as foobar2000) include an internal sample-rate conversion feature.<ref>{{Cite web |title=foobar2000: Components Repository |url=https://www.foobar2000.org/components/view/foo_dsp_src_resampler/releases |access-date=2026-04-17 |website=www.foobar2000.org}}</ref> Compared to operating system level audio resampling, the media player software itself may implement high-quality audio resampling algorithms, but uses more CPU resources.<ref>https://kevinboone.me/sample48.html</ref>{{sps|date=April 2026}}

== See also == Sample rate conversion in multiple dimensions: * Multivariate interpolation Techniques and processing that may involve sample-rate conversion: * Oversampling * Transcoding Techniques used in related processes: * Dither

== Notes == {{notelist-ua}}

== References == <references>

<ref name="Oppenheim-1999"> {{Cite book |last1=Oppenheim |first1=Alan V. |authorlink=Alan V. Oppenheim |last2=Schafer |first2=Ronald W. |author2-link=Ronald W. Schafer |last3=Buck |first3=John R. |title=Discrete-time signal processing |year=1999 |publisher=Prentice Hall |location=Upper Saddle River, N.J. |isbn=0-13-754920-2 |edition=2nd |url-access=registration |url=https://archive.org/details/discretetimesign00alan/ }} </ref>

<ref name="Lyons-2010"> {{cite book |last=Lyons |first=Richard |title=Understanding Digital Signal Processing |date=2010 |publisher=Prentice Hall |isbn=978-0137027415 |chapter=10. Sample Rate Conversion |quote=In satellite and medical image processing, sample rate conversion is necessary for image enhancement, scale change, and image rotation }}</ref>

<ref name="Antoniou-2006"> {{cite book |last=Antoniou |first=Andreas |title=Digital Signal Processing |date=2006 |publisher=McGraw-Hill |isbn=0-07-145424-1 |page=830 |quote=An alternative and more satisfactory approach... }}</ref>

<ref name="Partch-2009"> {{cite book |last1=Partch |first1=Harry |title=Genesis of a Music |date=2009 |publisher=Da Capo Press |isbn=978-0306801068 |page=101 |edition=Second |quote=The ratios of the "equal semitone" are, with progressive accuracy: 18/17, 89/84, 196/185 }}</ref>

<ref name="Bill Wood-2005"> {{citation |title=Apollo Television |url=https://www.hq.nasa.gov/alsj/ApolloTV-Acrobat5.pdf |publisher=NASA |author=Bill Wood |page=5 |year=2005}} </ref>

<ref name="Rajamani-2000"> {{cite journal |last1=Rajamani |first1=K. |last2=Yhean-Sen Lai |last3=Furrow |first3=C. W. |doi=10.1109/97.870683 |title=An efficient algorithm for sample rate conversion from CD to DAT |journal=IEEE Signal Processing Letters |volume=7 |issue=10 |pages=288 |year=2000 |bibcode=2000ISPL....7..288R |url=http://www.univie.ac.at/nuhag-php/bibtex/open_files/falara00_kannan%20rajamani.pdf}}</ref>

</references>

== Further reading == * {{cite book |last1=Crochiere |first1=R.E. |last2=Rabiner |first2=L.R. |title=Multirate Digital Signal Processing |year=1983 |publisher=Prentice-Hall |location=Englewood Cliffs, NJ |isbn=0136051626 |url=https://kupdf.net/download/multirate-digital-signal-processing-crochiere-rabiner_58a7065b6454a7e80bb1e993_pdf}}

== External links == * [https://ccrma.stanford.edu/~jos/resample/ Digital Audio Resampling Home Page] * [http://www.commsdesign.com/showArticle.jhtml?articleID=16504259 Multi-Rate Processing and Sample Rate Conversion: A Tutorial] * [http://ldesoras.free.fr/doc/articles/resampler-en.pdf The Quest For The Perfect Resampler] (PDF) * [http://en.dsplib.org/content/resampling_lagrange.html Digital resampling by using polynomial interpolation. Farrow filter] {{Webarchive|url=https://web.archive.org/web/20181001032425/http://en.dsplib.org/content/resampling_lagrange.html |date=2018-10-01 }} * [http://en.dsplib.org/content/resampling_lagrange_ex.html Using Farrow filter on the basis of piecewise cubic polynomial interpolation for digital signal resampling] {{Webarchive|url=https://web.archive.org/web/20180929211418/http://en.dsplib.org/content/resampling_lagrange_ex.html |date=2018-09-29 }}

Category:Digital signal processing Category:Digital audio Category:Audio engineering