-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibresamp.h
24 lines (23 loc) · 1.3 KB
/
libresamp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
/**
* Resamples the input by any real factor using an algorithm based on the
* convolution operation with the sinc function. **DOES NOT FILTER THE INPUT,
* ALIASING MAY OCCUR**.
*
* @param input An array where each element is a sample of the
* signal. If the signal has multiple channels all the samples of a channel
* must be in sequence. The array of a signal of length n samples then have
* n * channels elements where the first n elements are the samples of channel
* 1, the elements from n + 1 to n * 2 of channel 2 and so go on.
* @param length A pointer to the amount of samples in each channel.
* After the end of the resampling the value will be updated to reflect the
* output length.
* @param channels The number of channels represented in the input.
* @param resamplingFactor The resampling to be applied. Can be any real number.
* @param sampleRadius The number of samples before and after each point in
* the original signal considered relevant to the calculation of the new signal
* around the corresponding point.
* @return An array with the resampled signal. Respects the
* same channel order of the input.
*/
double* resample(double* input, unsigned* length, unsigned channels, double resamplingFactor, unsigned sampleRadius);