jass.generators
Class ModalQuencher

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

public class ModalQuencher
extends InOut

UG that maintains a list of sources and QuenchableModalObjectWithOneContact's and estimates excitations and turns off inaudible modes according to a masking analysis.

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

Field Summary
protected  float av
          Masking curve offset (how high about masker)
protected  float dbLevelLoudestMode
          This is the level in dB SPL of loudest mode (as hear by listener) Should be estimated with a mike, if possible.
protected  float maximumExdBThatOccurred
          maximum excitation occurred
protected  QuenchableModalObjectWithOneContact[] mobs
          Registered QuenchableModalObjectWithOneContact's
protected  jass.generators.ModeData[] modeData
          Modal data array
protected  int nFramesToSkip
          How many frames to skip before quenching again
protected  int nKilledModes
          For monitoring purpose
protected  int nTotalModes
           
protected  float[] sourceExcitations
          Estimated excitations of inputs to the above QuenchableModalObjectWithOneContact
 float srate
          Sampling rate in Hertz.
 
Fields inherited from class jass.engine.InOut
sourceContainer, sourcePassivity, srcBuffers
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
ModalQuencher(int bufferSize, int nFramesToSkip)
          Constructor.
 
Method Summary
 void addModalObject(QuenchableModalObjectWithOneContact s)
          Add QuenchableModalObjectWithOneContact to Sink.
protected  void computeBuffer()
          When this is called, all sources have already been queried (available through getSources().
protected  void doQuenching()
          Sort estimate excitations, sort ModeData[], quench
protected  void estimateExcitations()
          Estimate exitations.
 QuenchableModalObjectWithOneContact[] getModalObjects()
          Get array of QuenchableModalObjectWithOneContact's
 int getNKilledModes()
           
 int getTotalModes()
           
 void init()
          To be called after all sources and mobs have been added
protected  void quench()
           
 void resetLevel()
          Reset level
 void setAv(float val)
          Set masking curve height.
 void setDbLevelLoudestMode(float val)
          Set level in dB SPL at observer of loudest mode.
 void setFramesToSkip(int n)
          How many frames (buffers) to skip before recomputing modal quenching
protected  void sortModeData()
           
 
Methods inherited from class jass.engine.InOut
addSource, 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

dbLevelLoudestMode

protected float dbLevelLoudestMode
This is the level in dB SPL of loudest mode (as hear by listener) Should be estimated with a mike, if possible. Here we just assume 60 dB as a "reference" level.


av

protected float av
Masking curve offset (how high about masker)


maximumExdBThatOccurred

protected float maximumExdBThatOccurred
maximum excitation occurred


srate

public float srate
Sampling rate in Hertz.


mobs

protected QuenchableModalObjectWithOneContact[] mobs
Registered QuenchableModalObjectWithOneContact's


sourceExcitations

protected float[] sourceExcitations
Estimated excitations of inputs to the above QuenchableModalObjectWithOneContact


modeData

protected jass.generators.ModeData[] modeData
Modal data array


nFramesToSkip

protected int nFramesToSkip
How many frames to skip before quenching again


nKilledModes

protected int nKilledModes
For monitoring purpose


nTotalModes

protected int nTotalModes
Constructor Detail

ModalQuencher

public ModalQuencher(int bufferSize,
                     int nFramesToSkip)
Constructor.

Parameters:
bufferSize - internal buffersize
nFramesToSkip - how many frames to skip before quenching again
Method Detail

getNKilledModes

public int getNKilledModes()
Returns:
number of modes that where pruned

getTotalModes

public int getTotalModes()
Returns:
total number of modes

init

public void init()
To be called after all sources and mobs have been added


setAv

public void setAv(float val)
Set masking curve height.

Parameters:
val - offset in dB (20 is safe, 1 is agressive)

setDbLevelLoudestMode

public void setDbLevelLoudestMode(float val)
Set level in dB SPL at observer of loudest mode. This will be the loudest value during a run.

Parameters:
val - loudest mode at loudest moment in dB

resetLevel

public void resetLevel()
Reset level


setFramesToSkip

public void setFramesToSkip(int n)
How many frames (buffers) to skip before recomputing modal quenching

Parameters:
n - nFramesToSkip

computeBuffer

protected void computeBuffer()
When this is called, all sources have already been queried (available through getSources(). Estimate excitations from sources for each QuenchableModalObjectWithOneContact, enter them in ModeData[], then turn on/off appropriate modes.

Specified by:
computeBuffer in class Out

doQuenching

protected void doQuenching()
Sort estimate excitations, sort ModeData[], quench


estimateExcitations

protected void estimateExcitations()
Estimate exitations. Load protected float[] sourceExcitations with sum_i sourceBuf^2[i], for the source buffers.


quench

protected void quench()

addModalObject

public void addModalObject(QuenchableModalObjectWithOneContact s)
Add QuenchableModalObjectWithOneContact to Sink.

Parameters:
s - QuenchableModalObjectWithOneContact to add.

getModalObjects

public QuenchableModalObjectWithOneContact[] getModalObjects()
Get array of QuenchableModalObjectWithOneContact's

Returns:
array of QuenchableModalObjectWithOneContact's, null if there are none.

sortModeData

protected void sortModeData()