public final class SincResampler extends Object implements Resampler
This implementation is based on the paper "A Flexible Sampling-Rate Conversion Method", by J. O. Smith and P. Gosset, or rather on the expanded tutorial on the "Digital Audio Resampling Home Page": http:*www-ccrma.stanford.edu/~jos/resample/
By building shifted FIR tables with samples according to the sampling frequency, this implementation dramatically reduces the computational effort in the filter convolutions, without any loss of accuracy. The filter convolutions are also vectorizable on current hardware.
Further possible optimizations are:
2 * pass_freq + sqrt [ 2 * pass_freq * orig_sample_freq
* (dest_sample_freq - 2 * pass_freq) / dest_sample_freq ]
Constructor and Description |
---|
SincResampler(double clockFrequency,
double samplingFrequency,
double highestAccurateFrequency)
Use a clock frequency of 985248Hz for PAL C64, 1022730Hz for NTSC C64.
|
Modifier and Type | Method and Description |
---|---|
boolean |
input(int input)
Inputs a given sample into this SincResampler.
|
static void |
main(String[] args)
Simple sin waveform in, power output measurement function.
|
int |
output()
Gets the current output sample.
|
void |
reset()
Resets this SincResampler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createResampler
public SincResampler(double clockFrequency, double samplingFrequency, double highestAccurateFrequency)
For resampling, the ratio between the clock frequency and the sample frequency is limited as follows: 125*clock_freq/sample_freq < 16384 E.g. provided a clock frequency of ~ 1MHz, the sample frequency can not be set lower than ~ 8kHz. A lower sample frequency would make the resampling code overfill its 16k sample ring buffer.
The end of passband frequency is also limited: pass_freq <= 0.9*sample_freq/2
E.g. for a 44.1kHz sampling rate the end of passband frequency is limited to slightly below 20kHz. This constraint ensures that the FIR table is not overfilled.
clockFrequency
- System clock frequency at HzsamplingFrequency
- Desired output sampling ratehighestAccurateFrequency
- public boolean input(int input)
public int output()
public static void main(String[] args)
args
- ArgumentsCopyright © 2018 Ken Händel. All rights reserved.