Sound.SC3.Lang.Random.Lorrain_1980

Description

Denis Lorrain. "A Panoply of Stochastic 'Cannons'". Computer Music Journal, 4(1):53-81, Spring 1980.

Synopsis

# Documentation

linear :: Floating a => a -> a -> aSource

§4.3.1 (g=1)

``` import System.Random
let r = take 32768 (randomRs (0.0,1.0) (mkStdGen 12345))
```
``` import Sound.SC3.Plot
import Sound.SC3.Plot.Histogram
let h = plotHistogram . map (histogram 512)
```
``` h [map (linear 1.0) r]
```

exponential :: Floating a => a -> a -> aSource

§4.3.2 (δ=[0.5,1,2])

``` h (map (\d -> map (exponential d) r) [0.5,1,2])
```

cauchy :: Floating a => a -> a -> aSource

§4.3.5 (τ=1)

``` import Data.Maybe
let narrow z n = if n < -z || n > z then Nothing else Just n
h [mapMaybe (narrow 10 . cauchy 1.0) r]
```

cauchy' :: Floating a => Bool -> a -> a -> aSource

§4.3.5 (iopt=False,τ=1) (Algorithm 10)

``` h [mapMaybe (narrow 20 . cauchy' False 1.0) r]
h [mapMaybe (narrow 20 . cauchy' True 1.0) r]
```

hyperbolic_cosine :: Floating a => a -> aSource

§4.3.6

``` h [map hyperbolic_cosine r]
```

logistic :: Floating a => a -> a -> a -> aSource

§4.3.7 (β=0,α=1)

``` h [map (logistic 0.0 1.0) r]
```

arc_sine :: Floating a => a -> aSource

§4.3.8

``` h [map arc_sine r]
```

beta :: (Floating a, Ord a) => a -> a -> (a, a) -> Maybe aSource

§4.4.2 (Algorithm 15)

``` let adj l = case l of {[] -> []; p:q:l' -> (p,q) : adj l'}
h [mapMaybe (beta 0.5 0.5) (adj r)]
h [mapMaybe (beta 0.25 0.25) (adj r)]
h [mapMaybe (beta 0.75 0.5) (adj r)]
h [mapMaybe (beta 0.5 0.75) (adj r)]
```