## Resampling

As Wikipedia says, resampling is the process of changing the sampling rate of a discrete signal to obtain a new discrete representation of the underlying continuous signal

.

When continuous signal is provided, it is desirable to represent it in computer memory. As it is known, computers operate on discrete numbers, precisely on bit words. Sampling is a process of reduction continuous signal to a discrete signal that is representable as bit words.

The continuous signal *S(t)* is being measured every *T* seconds, which is called the sampling interval. Now, it is possible to represent the signal as series of points in time, *i*, starting from some specific point *T _{0}*, associated with the measured value,

*S*. Expression is called sampling frequency or sampling rate; the average number of samples obtained in one second.

_{i}DAB system works in four modes; each mode differs from other; see Table 1 below.

I | II | III | IV | |
---|---|---|---|---|

Frame duration | 96 ms | 24 ms | 24 ms | 48 ms |

Elementary period T |
488.3 ns (1/2048000 s) | |||

Frame duration as multiple of T |
196608 T | 98304 T | 49152 T | 49152 T |

Normally, DAB uses 2.048 MHz sampling rate with a period *T* of 0.48828µs. Fetching data from the air is easy – tuner sampling frequency can be adjusted to fit the DAB one. When fetching data from previously recorded file – computationally complex software processing is a must.

In general, the problem is to correctly compute signal values at arbitrary times from a set of discrete time samples of the signal amplitude. In order to change sampling frequency (resample), signal has to be interpolated between the samples.

*sdrdab*, the

*libsamplerate*by Erik de Castro Lopo is used.

*libsamplerate*is utilized in professional applications like Audacity. The library provides five interpolation methods:

`SRC_SINC_BEST_QUALITY`

`SRC_SINC_MEDIUM_QUALITY`

`SRC_SINC_FASTEST`

`SRC_LINEAR`

`SRC_ZERO_ORDER_HOLD`

### Performance

Performance of *libsamplerate* has been measured at Arch Linux Advanced Linux Sound Architecture talk. 8 second 1-22050 Hz sine sweep; 32-bit signed integer PCM with 44.1 kHz sample rate and 48kHz output sample rate has given results shown in Table 2.

user | system | CPU | total | |
---|---|---|---|---|

linear | 0.01s | 0.04s | 0% | 8.138 |

sinc fastest | 0.38s | 0.01s | 4% | 8.147 |

sinc medium | 0.60s | 0.01s | 7% | 8.149 |

sinc best | 1.36s | 0.01s | 16% | 8.204 |

`SRC_ZERO_ORDER_HOLD`

was omitted, because it adapts sampling frequency by simply copying the closest sample into the required place.

The quality parameter (interpolation method) is useful for controlling the quality/complexity tradeoff. In *sdrdab* `SRC_SINC_FASTEST`

is used, which is a reasonable compromise between precision and speed. This results in ~4-8% CPU utilization in regard to overall *sdrdab* computing power consumption.