jass.contact
Class ContactForceN

java.lang.Object
  extended by jass.engine.Out
      extended by jass.contact.ContactForceN
All Implemented Interfaces:
Source

public class ContactForceN
extends Out

A force model with impact, slide, and slide modes based on looping wav files. Roll force is fed through lowpass filter. It allows for N scraping textures, represented by N wav files. You can set which wav file you want to use for scraping, or any linear superposition of the N wav files. Since rolling still has only one wav file this generator is really useful only for scraping at present.

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

Field Summary
protected  BangForce bangForce
           
protected  float dryRollGain
           
protected  float fLowPass
           
protected  Butter2LowFilter lowPassFilter
           
protected  int nSlideForces
           
protected  float physicalToAudioGainImpact
           
protected  float physicalToAudioGainRoll
           
protected  float physicalToAudioGainSlide
           
protected  FilterContainer rollForce
           
protected  LoopBuffer rollForceRaw
           
protected  float rollSpeed1
           
protected  float[] slideBalance
           
protected  LoopNBuffers slideForce
           
protected  float slideSpeed1
           
protected  float vroll0
           
protected  float vroll1
           
protected  float vslide0
           
protected  float vslide1
           
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
  ContactForceN(float srate, int bufferSize, java.lang.String fnImpact, java.lang.String[] fnSlide, java.lang.String fnRoll)
          Construct contact force from named files.
protected ContactForceN(int bufferSize)
          Contructor intended only for subclass constructors (super(bufferSize);)
 
Method Summary
 void bang(float force, float dur)
          Generate impact force in physical units.
 void computeBuffer()
          Compute the next buffer.
 float[] getSlideBalance()
          get balance
 void setRollFilter(float fLowPass, float dryRollGain)
          Set roll force filter properties: cutoff and drygain.
 void setRollProperties(float force, float speed)
          Set roll speed and normal force in physical units.
 void setSlideBalance(float[] bal)
          Set balance verctor for slide force components
 void setSlideProperties(float force, float speed)
          Set slide speed and normal force in physical units.
 void setStaticContactModelParameters(float slideSpeed1, float rollSpeed1, float vslide0, float vslide1, float vroll0, float vroll1, float physicalToAudioGainSlide, float physicalToAudioGainRoll, float physicalToAudioGainImpact)
          Set model parameters mapping physical units to audio units
 
Methods inherited from class jass.engine.Out
clearBuffer, copyToOld, getBuffer, getBuffer, getBufferSize, getTime, peekAtBuffer, resetTime, setBufferSize, setTime, setTimeAndNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bangForce

protected BangForce bangForce

slideForce

protected LoopNBuffers slideForce

nSlideForces

protected int nSlideForces

rollForceRaw

protected LoopBuffer rollForceRaw

rollForce

protected FilterContainer rollForce

lowPassFilter

protected Butter2LowFilter lowPassFilter

fLowPass

protected float fLowPass

dryRollGain

protected float dryRollGain

slideSpeed1

protected float slideSpeed1

rollSpeed1

protected float rollSpeed1

vslide0

protected float vslide0

vslide1

protected float vslide1

vroll0

protected float vroll0

vroll1

protected float vroll1

slideBalance

protected float[] slideBalance

physicalToAudioGainSlide

protected float physicalToAudioGainSlide

physicalToAudioGainRoll

protected float physicalToAudioGainRoll

physicalToAudioGainImpact

protected float physicalToAudioGainImpact
Constructor Detail

ContactForceN

protected ContactForceN(int bufferSize)
Contructor intended only for subclass constructors (super(bufferSize);)


ContactForceN

public ContactForceN(float srate,
                     int bufferSize,
                     java.lang.String fnImpact,
                     java.lang.String[] fnSlide,
                     java.lang.String fnRoll)
Construct contact force from named files.

Parameters:
srate - sampling rate in Hertz.
bufferSize - bufferSize of this Out.
fnImpact - Audio file name for impact. (For example cos20ms.wav.)
fnSlide - Audio file names for slide. (For example grid.wav.)
fnRoll - Audio file name for slide. (For example roll.wav.)
Method Detail

setStaticContactModelParameters

public void setStaticContactModelParameters(float slideSpeed1,
                                            float rollSpeed1,
                                            float vslide0,
                                            float vslide1,
                                            float vroll0,
                                            float vroll1,
                                            float physicalToAudioGainSlide,
                                            float physicalToAudioGainRoll,
                                            float physicalToAudioGainImpact)
Set model parameters mapping physical units to audio units

Parameters:
slideSpeed1 - maximum audio loop speed (1 = original recording)
rollSpeed1 - maximum audio loop speed (1 = original recording)
vslide0 - minimum physical speed (lower than this is considered to be zero)
vslide1 - maximum physical speed (higher than this is set to this value)
vroll0 - minimum physical speed (lower than this is considered to be zero)
vroll1 - maximum physical speed (higher than this is set to this value)
physicalToAudioGainSlide - multiplies normal force to get slide gain
physicalToAudioGainRoll - multiplies normal force to get roll gain
physicalToAudioGainImpact - multiplies impact force to get impact gain

setSlideBalance

public void setSlideBalance(float[] bal)
Set balance verctor for slide force components

Parameters:
bal - vector of balances

getSlideBalance

public float[] getSlideBalance()
get balance

Returns:
array of balances

bang

public void bang(float force,
                 float dur)
Generate impact force in physical units.

Parameters:
force - magnitude.
dur - duration in seconds of impact.

setSlideProperties

public void setSlideProperties(float force,
                               float speed)
Set slide speed and normal force in physical units.

Parameters:
force - normal force.
speed - relative surface velocity.

setRollProperties

public void setRollProperties(float force,
                              float speed)
Set roll speed and normal force in physical units.

Parameters:
force - normal force.
speed - roll velocity.

setRollFilter

public void setRollFilter(float fLowPass,
                          float dryRollGain)
Set roll force filter properties: cutoff and drygain.


computeBuffer

public void computeBuffer()
Compute the next buffer.

Specified by:
computeBuffer in class Out