Probability Distributions
by Warren Burt

Since ArtWonk has a probability module, in which you can specify just about any probability curve you want, why would one be interested in using probability distributions from the world of mathematics? Well, you might be able to draw any of these curves with the probability module, but you'd first have to know what these distributions were, in order to use them. Having them here, in function form, is a great way to learn about probability distributions. And besides, these probability distributions are a wonderful source of found objects. By playing with these, and adjusting their parameters, all sorts of surprising results occur.

Note also, that the output of these distributions can be treated with any of the other modules in ArtWonk to produce useful ranges of numbers. A few observations about usage follow:

1) You will want to multiply the output of any distribution to get values in a scale that you want. For example, if your function gives you values between 0 and 1, if you multiply that result by 60 and then put that result through an IMod module, also set to 60, and you apply that to pitch choice on a midi module, then voila! Pitch change occurring over a 5 octave range.

2) To get the inversion of any distribution that has outputs between 0 and 1, put the result through a SUB module, subtract 1, and then take the ABS of that. This will give you a resulting distribution that is symmetrical with the original. That is, if the distribution you're using has many more low values than high values, the distribution you get by inverting it will have many more high values than low values.

3) If you add or multiply or average any of these distributions together, you'll get more complicated results.

4) To get Poisson-like distributions, or Geometric distributions, put a bell-like curve distribution, or an exponential distribution through an INT module. This will produce discrete values for the result, which is the characteristic of Poisson and Geometric distributions.

The two sources for these functions are "Computer Music" by Charles Dodge and Tom Jerse, and "Appendix A: Compendium of Probability Distributions" to Regress +, a fine free mathematics program for the Mac. ( There are hundreds of other distributions out there, and if you get interested in this, you're encouraged to go out and harvest some of your own.

The demonstration patches for these distributions all use them to control pitches over a five octave range. This is just a quick way for you to hear the qualities of each of these distributions as a spray of pitches. (how many low or high pitches, etc.) You shouldn't let this emphasis on pitch inhibit you from using these distributions for controlling any and all aspects of sound, visuals or language.

And of course, these distributions can be used in any way you desire. Let's say that you have a distribution going through an INT module which is producing values 1,2,3,4 & 5. You can use these values any way you like. For example, you could have an array with 5 different midi key numbers in it. Each key could select a different sample. So you could use a probability distribution to select the midi key values from the array, which would then trigger off your (weighted) choice of 5 different samples. Or anything else. Durations, loudness levels, length of sections of a piece, tempi, etcetera.

Notes on the individual distributions follow. At the end of each section is the equation for the distribution as used in the function module in ArtWonk.

Beta Distribution (BetaDst.awf)

This is a unique distribution, with a shape unlike any other. Giving values between 0 and 1, it can emphasize the high and low values, with not too many results in the middle. There are two variables A & B, and several shapes.

When A & B > 1, it gives a bell-like Gaussian density.

When A = B = 1, it gives a degenerate case of the uniform density.

When A < 1 and B < 1, A controls the probability of values close to 0, while

B controls the probability of values close to 1.

In this case, you get the curve with the end values emphasized, and the middle values suppressed.




Out(1, (C/E))

BOREL Distribution.

This is not so much a distribution as a way of generating patterns. Over the long term, the distribution will be uniform, with an equal probability of any value occuring. But in the short term, the nature of the switching used will guarantee that you get patterns of ascending values clustering together. There are two versions of the Borel Distribution, Borel A and Borel B, and a Macro which alternates between the two. For the functions, the output should be fed back into X in through a Latest Module. For the Macro, the bottom input gives a starting value.

Borel A:



C.(In2+ Abs(B-A))

Borel B:



C.( In2+ Abs(B-A))

Bradford Distribution (BradfordDst.awf)

This is a right-skewed distribution, which means that there are more low values than high values produced. There are a variety of shapes, controlled by a shape variable. This distribution can also give values between any lower and upper value that you set. For normal useage, these values would be set between 0 and 1, but other ranges would be possible. There are 3 variables, A, B and C

A = the location, or start of the distribution. Set to 0 for values between 0 and 1.

B = the scale, or upper bound. Set to 1 for values between 0 and 1.

C = the shape. 5 = many more lows than highs; 1 = a few more lows than highs.

C can actually go very high >100 or more, and you'll get more and more skewed results.

Out(1, ((1/In4)*((In2*(In4+1)-In3+(In3-In2)*((In4+1)^Ran)))))

Bradford Mistake Distribution (BrdfdMstkDst.awf)

This is an attempt at the Bradford distribution, but I made a mistake with the ^Ran at the end of the equation, applying it to the wrong parentheses. It's included here because it shows that even a wrong equation can generate interesting results, and to encourage you to try out modifiying existing equations, or even making up your own equations for distributions. There are a variety of shapes, controlled by a shape variable. This distribution uses the lower and upper value that you set as a guide to range, but not quite. For normal useage, set variable A to 0 and variable B to 1,and hear what happens when you change variable C.

A = the location, or start of the distribution. Set to 0 for values between 0 and 1.

B = the scale, or upper bound. Set to 1 for values between 0 and 1.

C = the shape. If you set the value to 1, you'll just get repeating values of 0. If you set it to 0.9, you'll get values clustering around .98. If you set it to 1.1, you'll get values clustering around 1.02. As you increase or decrease the value, you'll hear the narrow band of values get wider. If you set the value to around 50, you'll get a result very similar to the (working version of the) Bradford distribution. In the BradfordMistakeDistribution patch, the IMOD is set to 60, and applied to control of pitch, so that with C = 0.9, you'll get a cluster of very high notes, and with C = 1.1, you'll get a cluster of very low notes.

Out(1, ((1/In4)*((In2*(In4+1)-In3+(In3-In2)*(In4+1))^Ran)))

Burr Distribution (BurrDst.awf)

The Burr Distribution is a very controllable distribution with a variety of shapes. It's somewhat right-skewed, which means that there will be more low values than high, but it can assume a variety of shapes based on the settings of the variables. It has 4 variables, A, B, C, and D.

A = location, the start of your distribution. 0 is a good value for this.

B = Scale, the "height" of the "hump" where you'll get the most frequently occuring value. 1 makes a higher "hump" than 2 does.

C and D = shape controls.

C = 2 = sharper initial rise of curve; C = 3 = shallower initial rise of curve.

D = 1 = sharper fall of curve; D = 2 shallower fall of curve.

This distribution produces values well above 1 (waaaay above 1), so you'll want to scale its output to get some useful values.

The Burr Distribution is a generalized distribution. It can assume the shapes of several other distributions.

With D = 1, it's often called the Fisk or LogLogistic distribution.

Out(1, (In2+(In3*(((1/(Ran^(1/In(5))))-1)^-(1/In4)))))

Cauchy Distribution (CauchyDst.awf)

The Cauchy Distribution produces bell-like curves which can be controlled as to their height and width. They always produce more values in the middle than at either of their ends. There are 2 variables, A and B.

A = Location - the center of the "hump." If 0, you'll get positive and negative values.

B = Scale. 1 = Moderately high. 0.5 = higher.

The Cauchy Distribution is sometimes also called the Lorentz distribution.

Out(1, (In2+(In3*Tan(pi*(Ran-(1/2))))))

Exponential Distribution (ExpDst.awf)

The Exponential Distribution produces numbers which have a much greater chance of occurring closer to 0. There's only one variable, A.

A = The "height" of the left end of the curve. The mean of the distribution is .69315/A. For example if A = 1, the mean will be .69315 and 99.9% of all results will fall below 6.9078. A can be as high as 20 or more, but best results seem to occur between 0.5 and about 8.

If you put the Exponential Distribution through an INT module, you'll get the Geometric Distribution.

Out(1, (-log(Ran)/In2))

Extreme LB Distribution (ExtrmLBDst.awf)

This is an Extreme Distribution - one that can have EXTREMELY high values,but it has a lower limit, or bound, set by A. There are three variables, A, B, and C.

A = Lowest value output. Can be 0, 1, or anything.

B = Scale, or "height" of the "hump." 0.5 is high and tight, 2 is lower and wider.

C = Shape. 2 = steep sides; 3 = shallower sides. C less than 1 will give VERY high values out. Be careful!

Out(1, In2+(In3*((-log(Ran))^-(1/In4))))

Gaussian (normal) Distribution

Do you want to be normal? Then this is the distribution for you! This is the classic "bell-shaped" curve beloved of pseudo-scientific thinkers everywhere. Now, you, too, can base your music on pseudo-science with this nifty distribution.

There are more values in the middle than at the ends. The middle is indicated by variable A, and the steepness of the slope by variable B.

A = location of middle of distribution.

B = steepness of slope of distribution. 0.1 = very narrow; 2= wider


Out(1, In3*(C-6)+In2)

Generalized Logistic Distribution (GnLgstcDst.awf)

This is a bell-like curve known as the Logistic Distribution, but with an additional parameter C, which enables you to set the skew of the bell-like curve.

C = 1, it's the normal logistic curve

C > 1 - it's right-skewed (higher values predominate)

C < 1 - it's left-skewed (lower values predominate)

Three variables, A, B, and C, with B & C > 0.

A = Centre of the "peak" of the hump.

B = height of the "peak" - 1 = lower; 0.5 = higher.

C = Skewedness of the shape. 1= symmetrical; >1=higher favored; <1 = lower favored.

Out(1, In2-(In3*(log((1/(Ran^(1/In4)))-1))))

Gumbel Distribution (GumbelDst.awf)

This is another left-skewed "hump" distribution with a controllable shape. It's an extreme value distribution. it can give very high values, because it's unbounded on the high side. It has two variables, A and B.

A = location - the "peak" of the "hump".

B = scale - 1 = higher; 2 = lower.

The Gumbel Distribution has many other names. It's also known as the LogWeibull, Gompertz, and the Fisher-Tippett distribution.

Out(1, In2-(In3*(log(-log(Ran)))))

Laplace Distribution (Bilateral Exponential) (LaplaceDst.awf)

This is a distribution which has a sharp curve, like the exponential distribution, but is symmetrical around a center point, A. The "height" of the center point is set by a variable B.

A = center point. If 0, you get both postive and negative values.

B = "height" of the "peak". 1= lower peak; 0.6 = higher peak.

This is known as the Laplace distribution, also as the double exponential distribution and the bilateral exponential distribution (called bilex in some programs).

DimLocal(2) ; make a local array to store -1 and 1 in

Store(0,-1) ; put -1 in the 0 position

Store(1,1) ; put 1 in the 1 position

C.(Fetch((2*Ran)>1)) ; put into variable C either a -1 or a 1

Out(1,In2-(C*(In3*log(Ran)))) ; C is the random sign in the equation

LEHMER Function.

The Lehmer Function is an equation used to generate pseudo random sequences in many computer programs, such as Fortran. But with values of A and B below 10, it can generate semi-repetitive patterns of interest. For example, is A+B < 1.0, then you get a single repeating value. If A+B = slightly more than 1, you'll get repeating patterns with some degree of randomness. As A + B get larger, you get closer and closer to a uniformly distributed pseudo-random sequence. The values in the demo patch for this (LehmerFunctionDemo.awp) will show you some of the possibilities.

A.( ((In2*In3)+In4))

Out(1, A Mod In(5))

Pareto Distribution (ParetoDst.awf)

This distribution is always right skewed. That is, there will always be many more low values than high values. There are two variables, A and B.

A must be greater than 0. It's the lower limit of the distribution.

B must be greater than 0. It's the "height" of the low end of the graph. 1 = low. 2 = higher.

This distribution is sometimes used in economics as a measure of the probability of a particular income being above a given level. If you use this distribution, maybe your income will rise above that level! Then again, there might not be much probability of that......:-)

Out(1, In2/(Ran^(1/In3)))

Reciprocal Distribution (RcprclDst.awf)

This distribution is always right skewed, and very steeply so. There will always be many many more low values than high with this. The shape of the curve is controlled by 2 variables, A and B.

A must be greater than 0. 1 is a reasonable value. It's the lower limit of output.

B must be greater than A. 60 is a reasonable value. It's the upper limit of output.

The Reciprocal distribution is often used to decribe 1/f noise.


Out(1, (In2^(1-C)*(In3^C)))

Weibull Distribution (WeibullDst.awf)

This is another useful distribution which can change shape based on its parameters. There are two variables, A and B.

A = the mean value. The "centre" of the distribution.

B = Shape. 0.5 = many more lows than highs. 1= sort of flat, but favoring lows. 3 = almost a bell-like curve.

With such a wide range of shapes, you can change B and get all sorts of results.

Out(1, In2*(log(1/(1-Ran))^(1/In3)))