jass.generators
Class HalfSampleDelayKLFilter

java.lang.Object
  extended by jass.generators.HalfSampleDelayKLFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
HalfSampleDelayTubeFilter

public class HalfSampleDelayKLFilter
extends java.lang.Object
implements Filter

Half sample delay Kelly-Lochbaum filter. See Master thesis of Siddarth Mathur, Univ. of Arizona 2003 for details of the algorithm. This implementation defines a tube of a certain maximum number of segments. the actual end segment depends on the actual length and can be modified at run-time.

Author:
Kees van den Doel (kvdoel@cs.ubc.ca)

Nested Class Summary
 class HalfSampleDelayKLFilter.State
           
 
Field Summary
protected  float srate
          Sampling rate in Hertz.
protected  HalfSampleDelayKLFilter.State state
           
 
Constructor Summary
HalfSampleDelayKLFilter()
           
HalfSampleDelayKLFilter(float srate, int nTubeSections)
          Create and initialize.
 
Method Summary
protected  void allocate()
           
protected  void computeReflectionCoeff()
          Compute reflection coefficients from areas
 void filter(float[] output, float[] input, int nsamples, int inputOffset)
          Proces input (may be same as output).
 void resetFilter()
          Clear filter of past history
 void setAllCylinderRadii(double[] r)
          Set all radii
 void setCylinderRadius(int k, double r)
          Set an individual segment radius
 void setDampingCoeff(double val)
          Set damping coeff.
 void setEnd(int end)
          Set actual number of segments used
 void setGlottalReflectionCoeff(double val)
          Set the glottal reflection coeff.
 void setLipReflectionCoeff(double val)
          Set the end (lip) reflection coeff.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

srate

protected float srate
Sampling rate in Hertz.


state

protected HalfSampleDelayKLFilter.State state
Constructor Detail

HalfSampleDelayKLFilter

public HalfSampleDelayKLFilter(float srate,
                               int nTubeSections)
Create and initialize.

Parameters:
srate - sampling rate in Hertz.
nTubeSection - maximum number of sections (must be even)

HalfSampleDelayKLFilter

public HalfSampleDelayKLFilter()
Method Detail

allocate

protected void allocate()

resetFilter

public void resetFilter()
Clear filter of past history


setEnd

public void setEnd(int end)
Set actual number of segments used

Parameters:
end - number of segments (so last segment used has index end-1)

computeReflectionCoeff

protected void computeReflectionCoeff()
Compute reflection coefficients from areas


setGlottalReflectionCoeff

public void setGlottalReflectionCoeff(double val)
Set the glottal reflection coeff.

Parameters:
val - glottal reflection coefficient

setLipReflectionCoeff

public void setLipReflectionCoeff(double val)
Set the end (lip) reflection coeff.

Parameters:
val - glottal reflection coefficient (positive, actual coeff is negative)

setDampingCoeff

public void setDampingCoeff(double val)
Set damping coeff. (1 == no damping)

Parameters:
val - damping coefficient

setCylinderRadius

public void setCylinderRadius(int k,
                              double r)
Set an individual segment radius

Parameters:
k - index of segment (0,...)
r - radius to set

setAllCylinderRadii

public void setAllCylinderRadii(double[] r)
Set all radii

Parameters:
array - of r radii

filter

public void filter(float[] output,
                   float[] input,
                   int nsamples,
                   int inputOffset)
Proces input (may be same as output). Implements Filter interface

Specified by:
filter in interface Filter
Parameters:
output - user provided buffer for returned result.
input - user provided input buffer.
nsamples - number of samples written to output buffer.
inputOffset - where to start in circular buffer input (unused)