Class EventDistributions

java.lang.Object
com.softsynth.jmsl.util.EventDistributions

public class EventDistributions
extends java.lang.Object
Implements 'entry delay approach' to generate event densities. From Charles Ames's suggestions in letter dated March 17, 1992 Source for Myhill distribution and additional comments from "A Catalog of Statistical Distributions" by Charles Ames. Leonardo Music Journal, Vol. 1 No. 1, 1991 This code implements the exponential distribution and the Myhill distribution. The Myhill distribution can be thought of as a more flexible exponential distribution; one whose variance can be controlled. This control is reflected in a ratio whose value causes the Myhill distribution to more or less approximate the exponential distribution. When the ratio is high (above 128), the two distributions are indistinguishable. When ratio is low, the Myhill transform generates increasingly regular, periodic patterns, as opposed to the clustering and leaps of the exponential transform.
Author:
Nick Didkovsky and Phil Burk, copyright 1997 Nick Didkovsky and Phil Burk, all rights reserved.
JMSL is based on Hierarchical Music Specification Language (HMSL), which was created by Phil Burk, Larry Polansky, and David Rosenboom at the Mills College Center for Contemporary Music.
  • Constructor Summary

    Constructors
    Constructor Description
    EventDistributions()  
  • Method Summary

    Modifier and Type Method Description
    static double genEntryDelayLog​(double meanEventDensity)
    GENERATE ENTRY DELAYS FROM LOGARITHMIC DISTRIBUTION
    This gives you lots of short entry delays with an occasional long one.
    static double genEntryDelayMyhill​(double meanEventDensity, double ratio)
    GENERATE ENTRY DELAYS FROM MYHILL DISTRIBUTION
    This distribution maintains the balance of long to short durations that makes the logarithmic distribution appealing, additionally giving you control over mean AND variance.
    static void main​(java.lang.String[] args)
    Print out distributed entry delays

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EventDistributions

      public EventDistributions()
  • Method Details

    • genEntryDelayLog

      public static double genEntryDelayLog​(double meanEventDensity)
      GENERATE ENTRY DELAYS FROM LOGARITHMIC DISTRIBUTION
      This gives you lots of short entry delays with an occasional long one. A nice balance, but with no control over standard deviation from the mean event density. These comments taken from Ames, LMJ.
               f(u,m,sigma) = -(ln(1-u)) / m
               where m = (mean event density) and u is a driver value
               and distribution of entry delays is exponential
              
    • genEntryDelayMyhill

      public static double genEntryDelayMyhill​(double meanEventDensity, double ratio)
      GENERATE ENTRY DELAYS FROM MYHILL DISTRIBUTION
      This distribution maintains the balance of long to short durations that makes the logarithmic distribution appealing, additionally giving you control over mean AND variance. Also eliminates exceedingly short and exceedingly long values. These comments were taken from Ames, LMJ.
               f = -ln[(U1-U2)u + U2] / m
               where U2 = the (1-R)th root of R and U1 = U2^R
               R is a ratio relating the maximum and minimum samples.
               m is mean event density
               u is a driver value
              
               Comments taken from Ames on Ratio values:
               Ratio represents approximation to pure exponential.
               It is the ratio relating the maximum and minimum allowed samples.
               Thus a ratio of 5.0 with a mean of 7.0 would yield a range
               from 2.8 to 14.0, since 14/2.8=5 and is centered on 7
               Ratios over 128 makes Myhill behave indistinguishably from exponential.
               Ratios from 4 to 16 produce approximation ranging from 50% to 75%
               Ratios less than 2 are 'drunkenly regular'.
               Closer and closer to unity ratios generate more and more regular event patterns.
               
    • main

      public static void main​(java.lang.String[] args)
      Print out distributed entry delays