jass.generators
Class RandPulses

java.lang.Object
  extended by jass.engine.Out
      extended by jass.generators.RandPulses
All Implemented Interfaces:
Source

public class RandPulses
extends Out

Output random pulses uniform in range [-1 +1]. Probability per sample is pps. Amplitude is rnd^exponent.

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

Field Summary
protected  double exponent
           
protected  int interval_i
           
protected  float pps
          Probability per sample of pulse
protected  int pulseInterval
           
protected  boolean steadyRate
           
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
RandPulses(int bufferSize)
           
 
Method Summary
protected  void computeBuffer()
          Compute the next buffer and store in member float[] buf.
 void setProbabilityDistributionExponent(float exponent)
          Set impulse prob.
 void setProbabilityPerSample(float pps)
          Set impulse probability per sample.
 
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

pps

protected float pps
Probability per sample of pulse


exponent

protected double exponent

steadyRate

protected boolean steadyRate

pulseInterval

protected int pulseInterval

interval_i

protected int interval_i
Constructor Detail

RandPulses

public RandPulses(int bufferSize)
Method Detail

setProbabilityPerSample

public void setProbabilityPerSample(float pps)
Set impulse probability per sample. This will create pulse intervals which are exponentially distribted with mean interpulse time T = -1/srate ln(1-pps) ~ 1/srate*pps for small pps. So rate is srate * pps (-srate * ln(1-pps) precisely). Every 1/pps sample will have a pulse on average.

Parameters:
pps - probability per sample, or F_pulse/srate

setProbabilityDistributionExponent

public void setProbabilityDistributionExponent(float exponent)
Set impulse prob. exponent. Volume of impact is r^exponent, with r uniform on [0 1]

Parameters:
exponent - exponent of prob. distribution

computeBuffer

protected void computeBuffer()
Description copied from class: Out
Compute the next buffer and store in member float[] buf. This is the core processing method which will be implemented for each generator.

Specified by:
computeBuffer in class Out