synthesizer-core-0.4.0.4: Audio signal processing coded in Haskell: Low level part

Synthesizer.Plain.Control

Contents

Synopsis

Control curve generation

constant :: y -> T ySource

linearSource

Arguments

:: C y 
=> y

steepness

-> y

initial value

-> T y

linear progression

linearMultiscale :: C y => y -> y -> T ySource

Minimize rounding errors by reducing number of operations per element to a logarithmuc number.

linearMultiscaleNeutral :: C y => y -> T ySource

Linear curve starting at zero.

linearStable :: C y => y -> y -> T ySource

As stable as the addition of time values.

linearMean :: C y => y -> y -> T ySource

It computes the same like linear but in a numerically more stable manner, namely using a subdivision scheme. The division needed is a division by two.

0 4 8 0 2 4 6 8 0 1 2 3 4 5 6 7 8

linearSubdivision :: C y => T y -> T ySource

Intersperse linearly interpolated values.

lineSource

Arguments

:: C y 
=> Int

length

-> (y, y)

initial and final value

-> T y

linear progression

Linear curve of a fixed length. The final value is not actually reached, instead we stop one step before. This way we can concatenate several lines without duplicate adjacent values.

exponentialMultiscaleSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> y

initial value

-> T y

exponential decay

exponentialStableSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> y

initial value

-> T y

exponential decay

exponentialSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> y

initial value

-> T y

exponential decay

exponentialMultiscaleNeutralSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> T y

exponential decay

exponential2MultiscaleSource

Arguments

:: C y 
=> y

half life

-> y

initial value

-> T y

exponential decay

exponential2StableSource

Arguments

:: C y 
=> y

half life

-> y

initial value

-> T y

exponential decay

exponential2Source

Arguments

:: C y 
=> y

half life

-> y

initial value

-> T y

exponential decay

exponential2MultiscaleNeutralSource

Arguments

:: C y 
=> y

half life

-> T y

exponential decay

exponentialFromToMultiscaleSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> y

initial value

-> y

value after given time

-> T y

exponential decay

exponentialFromToSource

Arguments

:: C y 
=> y

time where the function reaches 1/e of the initial value

-> y

initial value

-> y

value after given time

-> T y

exponential decay

exponentialStableGen :: (C y, C t) => (t -> y) -> t -> y -> T ySource

vectorExponentialSource

Arguments

:: (C y, C y v) 
=> y

time where the function reaches 1/e of the initial value

-> v

initial value

-> T v

exponential decay

This is an extension of exponential to vectors which is straight-forward but requires more explicit signatures. But since it is needed rarely I setup a separate function.

vectorExponential2Source

Arguments

:: (C y, C y v) 
=> y

half life

-> v

initial value

-> T v

exponential decay

cosineMultiscaleSource

Arguments

:: C y 
=> y

time t0 where 1 is approached

-> y

time t1 where -1 is approached

-> T y

a cosine wave where one half wave is between t0 and t1

cosineSubdivSource

Arguments

:: C y 
=> y

time t0 where 1 is approached

-> y

time t1 where -1 is approached

-> T y

a cosine wave where one half wave is between t0 and t1

cosineStableSource

Arguments

:: C y 
=> y

time t0 where 1 is approached

-> y

time t1 where -1 is approached

-> T y

a cosine wave where one half wave is between t0 and t1

cosineSource

Arguments

:: C y 
=> y

time t0 where 1 is approached

-> y

time t1 where -1 is approached

-> T y

a cosine wave where one half wave is between t0 and t1

cosineSubdivision :: C y => y -> T y -> T ySource

cosineWithSlope :: C y => (y -> y -> signal) -> y -> y -> signalSource

cubicHermite :: C y => (y, (y, y)) -> (y, (y, y)) -> T ySource

cubicFunc :: C y => (y, (y, y)) -> (y, (y, y)) -> y -> ySource

0 16 0 8 16 0 4 8 12 16 0 2 4 6 8 10 12 14 16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

cubicHermiteStable :: C y => (y, (y, y)) -> (y, (y, y)) -> T ySource

cubicSubdivision :: C y => T y -> T ySource

data Control y Source

The curve type of a piece of a piecewise defined control curve.

Instances

Eq y => Eq (Control y) 
Show y => Show (Control y) 

data ControlPiece y Source

The full description of a control curve piece.

Constructors

ControlPiece 

Fields

pieceType :: Control y
 
pieceY0 :: y
 
pieceY1 :: y
 
pieceDur :: y
 

Instances

Eq y => Eq (ControlPiece y) 
Show y => Show (ControlPiece y) 

newtype PieceRightSingle y Source

Constructors

PRS y 

newtype PieceRightDouble y Source

Constructors

PRD y 

type ControlDist y = (y, Control y, y)Source

(#|-) :: (y, Control y) -> (PieceRightSingle y, [ControlPiece y]) -> (ControlDist y, [ControlPiece y])Source

The 6 operators simplify constructing a list of ControlPiece a. The description consists of nodes (namely the curve values at nodes) and the connecting curve types. The naming scheme is as follows: In the middle there is a bar |. With respect to the bar, the pad symbol # is at the side of the curve type, at the other side there is nothing, a minus sign -, or an equality sign =.

  1. Nothing means that here is the start or the end node of a curve.
  2. Minus means that here is a node where left and right curve meet at the same value. The node description is thus one value.
  3. Equality sign means that here is a split node, where left and right curve might have different ending and beginning values, respectively. The node description consists of a pair of values.

(#|) :: (y, Control y) -> y -> (ControlDist y, [ControlPiece y])Source

piecewise :: (C y, C y) => [ControlPiece y] -> T ySource

piecewisePart :: C y => y -> y -> y -> y -> Int -> Control y -> T ySource

Auxiliary functions

curveStable :: C t => (t -> y) -> (y -> y -> y) -> t -> y -> T ySource

double :: C t => t -> tSource

concatMapPair :: (a -> (b, b)) -> T a -> T bSource

flattenPairs :: T (a, a) -> T aSource

subdivide :: (y -> y -> y) -> T y -> T ySource

concatMapPair' :: (a -> (b, b)) -> T a -> T bSource

curveMultiscale :: (y -> y -> y) -> y -> y -> T ySource

curveMultiscaleNeutral :: (y -> y -> y) -> y -> y -> T ySource