jm.music.tools

## Class Prob

- java.lang.Object
- - jm.music.tools.Prob

-     public final class Prob
      extends java.lang.Object

  A utility class for generating random pitches, durations, etc in a gaussian distribution.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `gaussianDynamic(int meanDynamic, int stdDeviation)` Returns random dynamics dispersed by a gaussian distribution around the mean specified.
    `static double` | `gaussianFrequency(double meanFrequency, double stdDeviation)` Returns a random frequency dispersed by a gaussian distribution around the mean specified.
    `static double` | `gaussianPan(double meanPan, double stdDeviation)` Returns random pans dispersed by a gaussian distribution around the mean specified.
    `static double` | `gaussianPan(double meanPan, double stdDeviation, double maxPan)` Returns random pans dispersed by a gaussian distribution around the mean specified.
    `static int` | `gaussianPitch(int meanPitch, int stdDeviation)` Returns random pitches dispersed by a gaussian distribution around the mean specified.
    `static double` | `gaussianRhythmValue(double meanRV, double stdDev, double granularity)` Returns random rhythm values dispersed by a gaussian distribution around the mean specified.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### gaussianPitch

          public static final int gaussianPitch(int meanPitch,
                          int stdDeviation)

      Returns random pitches dispersed by a gaussian distribution around the mean specified. Around 68% of the pitches returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of pitches will be within twice this range.
      Parameters:
        `meanPitch` - the pitch that should be most commonly returned by this method.
        `stdDeviation` - the standard deviation measured in semitones.

    - #### gaussianFrequency

          public static final double gaussianFrequency(double meanFrequency,
                                 double stdDeviation)

      Returns a random frequency dispersed by a gaussian distribution around the mean specified. Around 68% of the frequencies returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of frequencies will be within twice this range.
      Parameters:
        `meanFrequency` - values returned should average this frequency
        `stdDeviation` - the standard deviation. See method comment

    - #### gaussianRhythmValue

          public static final double gaussianRhythmValue(double meanRV,
                                   double stdDev,
                                   double granularity)

      Returns random rhythm values dispersed by a gaussian distribution around the mean specified. Only rhythm values which are multiples of the `granularity` RV will be returned. Thus if you specify a granularity of JMC.CROTCHET quavers and dotted crotchets will not be returned.

      Around 68% of the rhythm values returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of rhythm values will be within twice this range.

      Parameters:
        `meanRV` - the average rhythm value returned
        `stdDev` - an rhythm interval defining the standard deviation.
        `granularity` - a rhythm value representing the minimum sort of value returned here. If you only want quavers and multiples of quavers, use JMC.QUAVER.

    - #### gaussianDynamic

          public static final int gaussianDynamic(int meanDynamic,
                            int stdDeviation)

      Returns random dynamics dispersed by a gaussian distribution around the mean specified. Around 68% of the dynamics returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of dynamics will be within twice this range. Dynamic values in jMusic are the same as MIDI, values between 1 (softest) and 127 (loudest).
      Parameters:
        `meanDynamic` - the dynamic that should be most commonly returned by this method.
        `stdDeviation` - the standard deviation. See method comment.

    - #### gaussianPan

          public static final double gaussianPan(double meanPan,
                           double stdDeviation)

      Returns random pans dispersed by a gaussian distribution around the mean specified. This method limits values returned between the range of 0.0 and 1.0. There is another method which allows you to specify a different max value for arrangments beyond stereo.

      Around 68% of the pans returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of pans will be within twice this range.

      Parameters:
        `meanPan` - the pan that should be most commonly returned by this method.
        `stdDeviation` - the standard deviation. See method comment.

    - #### gaussianPan

          public static final double gaussianPan(double meanPan,
                           double stdDeviation,
                           double maxPan)

      Returns random pans dispersed by a gaussian distribution around the mean specified. This method limits values returned between the range of 0.0 and `maxPan`. This method is useful if output from more than two speakers is required.

      Around 68% of the pans returned will be no greater than the mean plus the standard deviation specified and no less than the mean minus the standard deviation. Around 95% of pans will be within twice this range.

      Parameters:
        `meanPan` - the pan that should be most commonly returned by this method.
        `stdDeviation` - the standard deviation. See method comment.