jass.patches
Class CombReverb

java.lang.Object
  extended by jass.engine.Out
      extended by jass.engine.InOut
          extended by jass.patches.CombReverb
All Implemented Interfaces:
Sink, Source

public class CombReverb
extends InOut

CombReverb as Moorers reverb. See e.g.

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

Field Summary
protected  float a
           
protected  AllPass allPass
           
protected  float allpassDelay
           
protected  float[] combDelays
           
protected  float dryToWet
           
protected  Mixer endMixer
           
protected  float[] g
           
protected  LowPassComb[] lpCombs
           
protected  Mixer mixer
           
protected  int nchannels
           
protected  int nCombs
           
protected  float[] R
           
protected  float srate
           
 
Fields inherited from class jass.engine.InOut
sourceContainer, sourcePassivity, srcBuffers
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
CombReverb(int bufferSize)
          Create.
CombReverb(int bufferSize, float srate, int nCombs)
          Create.
CombReverb(int bufferSize, float srate, int nCombs, int nchannels)
          Create.
CombReverb(int bufferSize, int nchannels)
          Create.
 
Method Summary
 java.lang.Object addSource(Source s)
          Add source to Sink.
protected  void computeBuffer()
          Compute the next buffer and store in member float[] buf.
protected  void init()
          Init and allocate.
 void setA(float a)
          Set allpass coeff.
 void setAllParameters()
          Set all filter parameters
 void setDryToWet(float d)
          Set dryToWet ratio
 void setG(float g, int k)
          Set one pole lowpass coefficient g; H(z) = 1/(1-g/z))
 void setL(float del, int k)
          Set comb delay.
 void setM(float del)
          Set allpass delay: H(z) = (z^_{m} + a)/(1 + a*z^{-m}) Make sure is not snaller than buffersize
 void setNChannels(int n)
           
 void setR(float r, int k)
          Set feedback of filter k
 
Methods inherited from class jass.engine.InOut
addSource, getBuffer, getSources, removeSource, resetTime
 
Methods inherited from class jass.engine.Out
clearBuffer, copyToOld, getBuffer, getBufferSize, getTime, peekAtBuffer, setBufferSize, setTime, setTimeAndNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nchannels

protected int nchannels

srate

protected float srate

nCombs

protected int nCombs

combDelays

protected float[] combDelays

allpassDelay

protected float allpassDelay

a

protected float a

R

protected float[] R

g

protected float[] g

dryToWet

protected float dryToWet

lpCombs

protected LowPassComb[] lpCombs

allPass

protected AllPass allPass

mixer

protected Mixer mixer

endMixer

protected Mixer endMixer
Constructor Detail

CombReverb

public CombReverb(int bufferSize)
Create. For derived classes.

Parameters:
bufferSize - Buffer size used for real-time rendering.

CombReverb

public CombReverb(int bufferSize,
                  int nchannels)
Create. For derived classes.

Parameters:
bufferSize - Buffer size used for real-time rendering.
nchannels - 1 for mono

CombReverb

public CombReverb(int bufferSize,
                  float srate,
                  int nCombs)
Create. For derived classes.

Parameters:
bufferSize - Buffer size used for real-time rendering.
srate - sampling rate in Hz
nCombs - number of comb filters

CombReverb

public CombReverb(int bufferSize,
                  float srate,
                  int nCombs,
                  int nchannels)
Create. For derived classes.

Parameters:
nchannels - 1 for mono
bufferSize - Buffer size used for real-time rendering.
srate - sampling rate in Hz
nCombs - number of comb filters
Method Detail

setNChannels

public void setNChannels(int n)

init

protected void init()
Init and allocate. Defaults are usable.


setAllParameters

public void setAllParameters()
Set all filter parameters


setR

public void setR(float r,
                 int k)
Set feedback of filter k

Parameters:
r - feedback
k - index of comb filter

setG

public void setG(float g,
                 int k)
Set one pole lowpass coefficient g; H(z) = 1/(1-g/z))

Parameters:
g - lowpass filter coefficient
k - index of comb filter

setDryToWet

public void setDryToWet(float d)
Set dryToWet ratio

Parameters:
d - dry to wet. 1 is dry only

setA

public void setA(float a)
Set allpass coeff. a: H(z) = (z^_{m} + a)/(1 + a*z^{-m})

Parameters:
a - allpass coeff

setM

public void setM(float del)
Set allpass delay: H(z) = (z^_{m} + a)/(1 + a*z^{-m}) Make sure is not snaller than buffersize

Parameters:
del - allpass delay in seconds

setL

public void setL(float del,
                 int k)
Set comb delay. Make sure is not snaller than buffersize

Parameters:
del - allpass delay in seconds
k - index of comb filter

addSource

public java.lang.Object addSource(Source s)
                           throws SinkIsFullException
Add source to Sink. Override to allow one input only and add to mixer with gain coefficient a and to delay 2. This will be called after init() so mixer will already have 2 inputs

Specified by:
addSource in interface Sink
Overrides:
addSource in class InOut
Parameters:
s - Source to add.
Returns:
object representing Source in Sink (may be null).
Throws:
SinkIsFullException

computeBuffer

protected void computeBuffer()
Compute the next buffer and store in member float[] buf.

Specified by:
computeBuffer in class Out