Package com.softsynth.jmsl.util
Class Oof
java.lang.Object
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.
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
Constructors Constructor Description Oof(int numBits)Constructor, specify number of bits in desired output range
ex. -
Method Summary
Modifier and Type Method Description intgetNext()intgetSeed()static voidmain(java.lang.String[] args)intnext()Return next value in sequence, then generate a new one.voidrandomize()Set seed from system time.voidreset()Reset sequence generator so that it will restart at last saved seed value.voidsetNext(int next)UNIMPLEMENTED Set next value in sequence.voidsetSeed(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 Details
-
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 Details
-
next
public int next()Description copied from interface:SequenceGeneratorReturn next value in sequence, then generate a new one.- Specified by:
nextin interfaceSequenceGenerator- Returns:
- next value in 1/F sequence
-
getNext
public int getNext()- Specified by:
getNextin interfaceSequenceGenerator- Returns:
- next without changing current state
-
setNext
public void setNext(int next)UNIMPLEMENTED Set next value in sequence. UNIMPLEMENTED- Specified by:
setNextin interfaceSequenceGenerator
-
setSeed
public void setSeed(int seed)Set pseudo-random generator seed for repeatable sequences. Saves new seed for reset();- Specified by:
setSeedin interfaceSequenceGenerator
-
getSeed
public int getSeed()- Specified by:
getSeedin interfaceSequenceGenerator- 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:
randomizein interfaceSequenceGenerator
-
reset
public void reset()Reset sequence generator so that it will restart at last saved seed value.- Specified by:
resetin interfaceSequenceGenerator
-
main
public static void main(java.lang.String[] args)
-