Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Denis Lorrain. "A Panoply of Stochastic 'Cannons'". Computer Music Journal, 4(1):53-81, Spring 1980.
- linear :: Floating a => a -> a -> a
- exponential :: Floating a => a -> a -> a
- cauchy :: Floating a => a -> a -> a
- cauchy' :: Floating a => Bool -> a -> a -> a
- hyperbolic_cosine :: Floating a => a -> a
- logistic :: Floating a => a -> a -> a -> a
- arc_sine :: Floating a => a -> a
- beta :: (Floating a, Ord a) => a -> a -> (a, a) -> Maybe a
Documentation
linear :: Floating a => a -> a -> a Source
§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 -> a Source
§4.3.2 (δ=[0.5,1,2])
h (map (\d -> map (exponential d) r) [0.5,1,2])
cauchy :: Floating a => a -> a -> a Source
§4.3.5 (τ=1)
h [map (cauchy 1.0) r]
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 -> a Source
§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 -> a Source
§4.3.6
h [map hyperbolic_cosine r]
beta :: (Floating a, Ord a) => a -> a -> (a, a) -> Maybe a Source
§4.4.2 (Algorithm 15)
let adj l = case l of {[] -> []; p:q:l' -> (p,q) : adj l'} let r' = adj r h [mapMaybe (beta 0.45 0.45) r' ,mapMaybe (beta 0.65 0.45) r' ,mapMaybe (beta 0.45 0.65) r']
h [mapMaybe (beta 0.35 0.5) r' ,mapMaybe (beta 0.5 0.65) r']