synthesizer-0.2.0.1: Audio signal processing coded in HaskellSource codeContentsIndex
Synthesizer.Generic.Control
Contents
Control curve generation
Auxiliary functions
Synopsis
constant :: Write sig y => LazySize -> y -> sig y
linear :: (C y, Write sig y) => LazySize -> y -> y -> sig y
linearMultiscale :: (C y, Write sig y) => LazySize -> y -> y -> sig y
linearMultiscaleNeutral :: (C y, Write sig y) => LazySize -> y -> sig y
line :: (C y, Write sig y) => LazySize -> Int -> (y, y) -> sig y
exponentialMultiscale :: (C y, Write sig y) => LazySize -> y -> y -> sig y
exponential :: (C y, Write sig y) => LazySize -> y -> y -> sig y
exponentialMultiscaleNeutral :: (C y, Write sig y) => LazySize -> y -> sig y
exponential2Multiscale :: (C y, Write sig y) => LazySize -> y -> y -> sig y
exponential2 :: (C y, Write sig y) => LazySize -> y -> y -> sig y
exponential2MultiscaleNeutral :: (C y, Write sig y) => LazySize -> y -> sig y
vectorExponential :: (C y, C y v, Write sig v) => LazySize -> y -> v -> sig v
vectorExponential2 :: (C y, C y v, Write sig v) => LazySize -> y -> v -> sig v
cosineMultiscaleLinear :: (C y, Write sig y) => LazySize -> y -> y -> sig y
cosine :: (C y, Write sig y) => LazySize -> y -> y -> sig y
cosineMultiscale :: (C y, Write sig (T y), Transform sig (T y) y) => LazySize -> y -> y -> sig y
cosineWithSlope :: C y => (y -> y -> signal) -> y -> y -> signal
cubicHermite :: (C y, Write sig y) => LazySize -> (y, (y, y)) -> (y, (y, y)) -> sig y
cubicFunc :: C y => (y, (y, y)) -> (y, (y, y)) -> y -> y
data Control y
= CtrlStep
| CtrlLin
| CtrlExp {
ctrlExpSaturation :: y
}
| CtrlCos
| CtrlCubic {
ctrlCubicGradient0 :: y
ctrlCubicGradient1 :: y
}
data ControlPiece y = ControlPiece {
pieceType :: Control y
pieceY0 :: y
pieceY1 :: y
pieceDur :: y
}
newtype PieceRightSingle y = PRS y
newtype PieceRightDouble y = PRD y
type ControlDist y = (y, Control y, y)
(#|-) :: (y, Control y) -> (PieceRightSingle y, [ControlPiece y]) -> (ControlDist y, [ControlPiece y])
(-|#) :: y -> (ControlDist y, [ControlPiece y]) -> (PieceRightSingle y, [ControlPiece y])
(#|=) :: (y, Control y) -> (PieceRightDouble y, [ControlPiece y]) -> (ControlDist y, [ControlPiece y])
(=|#) :: (y, y) -> (ControlDist y, [ControlPiece y]) -> (PieceRightDouble y, [ControlPiece y])
(#|) :: (y, Control y) -> y -> (ControlDist y, [ControlPiece y])
(|#) :: y -> (ControlDist y, [ControlPiece y]) -> [ControlPiece y]
piecewise :: (C y, C y, Write sig y) => LazySize -> [ControlPiece y] -> sig y
piecewisePart :: (C y, Write sig y) => LazySize -> y -> y -> y -> y -> Int -> Control y -> sig y
curveMultiscale :: Write sig y => LazySize -> (y -> y -> y) -> y -> y -> sig y
curveMultiscaleNeutral :: Write sig y => LazySize -> (y -> y -> y) -> y -> y -> sig y
Control curve generation
constant :: Write sig y => LazySize -> y -> sig ySource
linearSource
:: (C y, Write sig y)
=> LazySize
-> ysteepness
-> yinitial value
-> sig ylinear progression
linearMultiscale :: (C y, Write sig y) => LazySize -> y -> y -> sig ySource
Minimize rounding errors by reducing number of operations per element to a logarithmuc number.
linearMultiscaleNeutral :: (C y, Write sig y) => LazySize -> y -> sig ySource
Linear curve starting at zero.
lineSource
:: (C y, Write sig y)
=> LazySize
-> Intlength
-> (y, y)initial and final value
-> sig ylinear 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
:: (C y, Write sig y)
=> LazySize
-> ytime where the function reaches 1/e of the initial value
-> yinitial value
-> sig yexponential decay
exponentialSource
:: (C y, Write sig y)
=> LazySize
-> ytime where the function reaches 1/e of the initial value
-> yinitial value
-> sig yexponential decay
exponentialMultiscaleNeutralSource
:: (C y, Write sig y)
=> LazySize
-> ytime where the function reaches 1/e of the initial value
-> sig yexponential decay
exponential2MultiscaleSource
:: (C y, Write sig y)
=> LazySize
-> yhalf life
-> yinitial value
-> sig yexponential decay
exponential2Source
:: (C y, Write sig y)
=> LazySize
-> yhalf life
-> yinitial value
-> sig yexponential decay
exponential2MultiscaleNeutralSource
:: (C y, Write sig y)
=> LazySize
-> yhalf life
-> sig yexponential decay
vectorExponentialSource
:: (C y, C y v, Write sig v)
=> LazySize
-> ytime where the function reaches 1/e of the initial value
-> vinitial value
-> sig vexponential 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
:: (C y, C y v, Write sig v)
=> LazySize
-> yhalf life
-> vinitial value
-> sig vexponential decay
cosineMultiscaleLinearSource
:: (C y, Write sig y)
=> LazySize
-> ytime t0 where 1 is approached
-> ytime t1 where -1 is approached
-> sig ya cosine wave where one half wave is between t0 and t1
cosineSource
:: (C y, Write sig y)
=> LazySize
-> ytime t0 where 1 is approached
-> ytime t1 where -1 is approached
-> sig ya cosine wave where one half wave is between t0 and t1
cosineMultiscaleSource
:: (C y, Write sig (T y), Transform sig (T y) y)
=> LazySize
-> ytime t0 where 1 is approached
-> ytime t1 where -1 is approached
-> sig ya cosine wave where one half wave is between t0 and t1
cosineWithSlope :: C y => (y -> y -> signal) -> y -> y -> signalSource
cubicHermite :: (C y, Write sig y) => LazySize -> (y, (y, y)) -> (y, (y, y)) -> sig 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
data Control y Source
The curve type of a piece of a piecewise defined control curve.
Constructors
CtrlStep
CtrlLin
CtrlExp
ctrlExpSaturation :: y
CtrlCos
CtrlCubic
ctrlCubicGradient0 :: y
ctrlCubicGradient1 :: y
show/hide 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
pieceType :: Control y
pieceY0 :: y
pieceY1 :: y
pieceDur :: y
show/hide Instances
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 -> (ControlDist y, [ControlPiece y]) -> (PieceRightSingle y, [ControlPiece y])Source
(#|=) :: (y, Control y) -> (PieceRightDouble y, [ControlPiece y]) -> (ControlDist y, [ControlPiece y])Source
(=|#) :: (y, y) -> (ControlDist y, [ControlPiece y]) -> (PieceRightDouble y, [ControlPiece y])Source
(#|) :: (y, Control y) -> y -> (ControlDist y, [ControlPiece y])Source
(|#) :: y -> (ControlDist y, [ControlPiece y]) -> [ControlPiece y]Source
piecewise :: (C y, C y, Write sig y) => LazySize -> [ControlPiece y] -> sig ySource
piecewisePart :: (C y, Write sig y) => LazySize -> y -> y -> y -> y -> Int -> Control y -> sig ySource
Auxiliary functions
curveMultiscale :: Write sig y => LazySize -> (y -> y -> y) -> y -> y -> sig ySource
curveMultiscaleNeutral :: Write sig y => LazySize -> (y -> y -> y) -> y -> y -> sig ySource
Produced by Haddock version 2.4.2