micromod.resamplers
Class LinearResampler

java.lang.Object
  extended bymicromod.resamplers.LinearResampler
All Implemented Interfaces:
Resampler

public class LinearResampler
extends java.lang.Object
implements Resampler

The linear resampler implements linear interpolation resampling. Linear interpolation prevents nasty harmonics being added to the sound during resampling. Technically, linear interpolation is not very good - but sound quality is a very subjective thing, and this resampler certainly has a low end "kick" that the FIR resampler certainly lacks(probably cause it ain't supposed to be there :) As as extra bonus, it's pretty fast!


Field Summary
 
Fields inherited from interface micromod.resamplers.Resampler
FIXED_POINT_BITMASK, FIXED_POINT_ONE, FIXED_POINT_SHIFT
 
Constructor Summary
LinearResampler()
           
 
Method Summary
 int getCushionSize()
          Return minimum number of samples required by the resampler before and after the audio to be processed.
 void resample(short[] inputBuf, int samplePos, int subSamplePos, int step, int subStep, short[] outputBuf, int position, int length)
          Resample the audio in inputBuf to outputBuf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearResampler

public LinearResampler()
Method Detail

resample

public void resample(short[] inputBuf,
                     int samplePos,
                     int subSamplePos,
                     int step,
                     int subStep,
                     short[] outputBuf,
                     int position,
                     int length)
Description copied from interface: Resampler
Resample the audio in inputBuf to outputBuf. The resampler should be able to deal correctly with a length of at least 1.

Specified by:
resample in interface Resampler
Parameters:
samplePos - The index of the sample in inputBuf
subSamplePos - The fractional part of the index, in 16 bit fixed point.
step - The integer part of the number of input samples per output sample.
subStep - The fractional part of the number of input samples per output sample. The value is in 16 bit fixed point.
position - The index of the output buffer to start writing to.
length - The number of samples of output to produce.

getCushionSize

public int getCushionSize()
Description copied from interface: Resampler
Return minimum number of samples required by the resampler before and after the audio to be processed. A cubic resampler might return 3, for example.

Specified by:
getCushionSize in interface Resampler