|
miniDSP
A small C library for audio DSP
|
Polyphase sinc resampler for offline sample rate conversion. More...
Go to the source code of this file.
Macros | |
| #define | RESAMPLE_NUM_PHASES 512 |
| Number of sub-phases in the polyphase filter table. | |
Functions | |
| unsigned | MD_resample_output_len (unsigned input_len, double in_rate, double out_rate) |
| Compute the output buffer size needed for resampling. | |
| unsigned | MD_resample (const double *input, unsigned input_len, double *output, unsigned max_output_len, double in_rate, double out_rate, unsigned num_zero_crossings, double kaiser_beta) |
| Resample a signal from one sample rate to another using polyphase sinc interpolation. | |
Polyphase sinc resampler for offline sample rate conversion.
Definition in file minidsp_resample.c.
| #define RESAMPLE_NUM_PHASES 512 |
Number of sub-phases in the polyphase filter table.
Definition at line 10 of file minidsp_resample.c.
| unsigned MD_resample | ( | const double * | input, |
| unsigned | input_len, | ||
| double * | output, | ||
| unsigned | max_output_len, | ||
| double | in_rate, | ||
| double | out_rate, | ||
| unsigned | num_zero_crossings, | ||
| double | kaiser_beta ) |
Resample a signal from one sample rate to another using polyphase sinc interpolation.
Uses a fixed table of 512 sub-phases with linear interpolation and a Kaiser-windowed sinc anti-aliasing filter. Anti-aliasing cutoff is automatically set to \(\min(\mathrm{in\_rate}, \mathrm{out\_rate})/2\).
| input | Input signal of length input_len. |
| input_len | Number of input samples (must be > 0). |
| output | Output buffer (caller-allocated). Use MD_resample_output_len() to size it. |
| max_output_len | Capacity of output buffer. Must be >= MD_resample_output_len(input_len, in_rate, out_rate). |
| in_rate | Input sample rate in Hz (must be > 0). |
| out_rate | Output sample rate in Hz (must be > 0). |
| num_zero_crossings | Number of sinc zero-crossings per side. Higher = better quality. Typical: 32. |
| kaiser_beta | Kaiser window shape parameter. Typical: 10.0 for ~100 dB stopband. |
Definition at line 21 of file minidsp_resample.c.
| unsigned MD_resample_output_len | ( | unsigned | input_len, |
| double | in_rate, | ||
| double | out_rate ) |
Compute the output buffer size needed for resampling.
Returns \(\lceil \mathrm{input\_len} \times \mathrm{out\_rate} / \mathrm{in\_rate} \rceil\).
| input_len | Number of input samples (must be > 0). |
| in_rate | Input sample rate in Hz (must be > 0). |
| out_rate | Output sample rate in Hz (must be > 0). |
Definition at line 12 of file minidsp_resample.c.