com.softsynth.jmsl.util
Class Oof

java.lang.Object
  extended by com.softsynth.jmsl.util.Oof
All Implemented Interfaces:
SequenceGenerator

public class Oof
extends java.lang.Object
implements SequenceGenerator

One over F distribution after R.F. Voss's algorithm, taken from Dodge/Jerse "Computer Music", Schirmer Books, page 290, translated from the Fortran

Each object maintains its own last value and random driver, so all you have to do is call next() on your Oof object to generate a 1/f sequence.

Author:
Nick Didkovsky Phil Burk

Constructor Summary
Oof(int numBits)
          Constructor, specify number of bits in desired output range
ex.
 
Method Summary
 int getNext()
           
 int getSeed()
           
static void main(java.lang.String[] args)
           
 int next()
          Return next value in sequence, then generate a new one.
 void randomize()
          Set seed from system time.
 void reset()
          Reset sequence generator so that it will restart at last saved seed value.
 void setNext(int next)
          UNIMPLEMENTED Set next value in sequence.
 void setSeed(int seed)
          Set pseudo-random generator seed for repeatable sequences.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Oof

public Oof(int numBits)
Constructor, specify number of bits in desired output range
ex. 4 gives a range of 0..15
ex. 8 gives a range 0..255

Initial random seed saved for reset()

Method Detail

next

public int next()
Description copied from interface: SequenceGenerator
Return next value in sequence, then generate a new one.

Specified by:
next in interface SequenceGenerator
Returns:
next value in 1/F sequence

getNext

public int getNext()
Specified by:
getNext in interface SequenceGenerator
Returns:
next without changing current state

setNext

public void setNext(int next)
UNIMPLEMENTED Set next value in sequence. UNIMPLEMENTED

Specified by:
setNext in interface SequenceGenerator

setSeed

public void setSeed(int seed)
Set pseudo-random generator seed for repeatable sequences. Saves new seed for reset();

Specified by:
setSeed in interface SequenceGenerator

getSeed

public int getSeed()
Specified by:
getSeed in interface SequenceGenerator
Returns:
seed set by setSeed.

randomize

public void randomize()
Set seed from system time. This will result in a unique sequence each time it is called. Also saves the seed for reset()

Specified by:
randomize in interface SequenceGenerator

reset

public void reset()
Reset sequence generator so that it will restart at last saved seed value.

Specified by:
reset in interface SequenceGenerator

main

public static void main(java.lang.String[] args)