|
kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
|
Resample a signal at arbitrary (e.g. More...
#include <resample.h>
Public Member Functions | |
| ArbitraryResample (int32_t num_samples_in, float samp_rate_hz, float filter_cutoff_hz, const std::vector< float > &sample_points_secs, int32_t num_zeros) | |
| Construct the resampler. | |
| int32_t | NumSamplesIn () const |
| Return the number of samples in each input signal. | |
| int32_t | NumSamplesOut () const |
| Return the number of samples in each resampled output signal (equals the sample_points_secs size given to the constructor). | |
| void | Resample (const MatrixF &input, MatrixF *output) const |
| Resample a batch of signals (one per row). | |
| void | Resample (const VectorF &input, VectorF *output) const |
| Resample a single signal. | |
Resample a signal at arbitrary (e.g.
log-spaced) time points.
Class ArbitraryResample allows you to resample a signal (assumed zero outside the sample region, not periodic) at arbitrary specified time values, which don't have to be linearly spaced. The low-pass filter cutoff filter_cutoff_hz should be less than half the sample rate; num_zeros should probably be at least two preferably more; higher numbers give sharper filters but will be less efficient.
| knf::ArbitraryResample::ArbitraryResample | ( | int32_t | num_samples_in, |
| float | samp_rate_hz, | ||
| float | filter_cutoff_hz, | ||
| const std::vector< float > & | sample_points_secs, | ||
| int32_t | num_zeros ) |
Construct the resampler.
| [in] | num_samples_in | Number of samples in each input signal (must be > 0). |
| [in] | samp_rate_hz | Sample rate of the input signal in Hz (must be > 0). |
| [in] | filter_cutoff_hz | Low-pass filter cutoff in Hz; must be > 0 and at most half of samp_rate_hz. |
| [in] | sample_points_secs | The time points (in seconds) at which to evaluate the resampled signal; one output sample is produced per element. |
| [in] | num_zeros | Filter sharpness: the raised-cosine window spans num_zeros zeros of the sinc filter (must be > 0; 2..10 recommended). |
|
inline |
Return the number of samples in each input signal.
|
inline |
Return the number of samples in each resampled output signal (equals the sample_points_secs size given to the constructor).
Resample a batch of signals (one per row).
| [in] | input | Matrix of shape (num_rows, NumSamplesIn()); each row is one input signal. |
| [out] | output | Matrix of shape (num_rows, NumSamplesOut()); must already be resized to that shape. Each row is the resampled version of the corresponding input row. |
Resample a single signal.
| [in] | input | Vector of size NumSamplesIn(). |
| [out] | output | Vector of size NumSamplesOut(); must already be resized to that shape. |