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

Copyright(c) Henning Thielemann 2008-2011
LicenseGPL
Maintainersynthesizer@henning-thielemann.de
Stabilityprovisional
Portabilityrequires multi-parameter type classes
Safe HaskellNone
LanguageHaskell2010

Synthesizer.Generic.Filter.NonRecursive

Description

 

Synopsis

Documentation

negate :: (C a, Transform sig a) => sig a -> sig a Source #

amplify :: (C a, Transform sig a) => a -> sig a -> sig a Source #

amplifyVector :: (C a v, Transform sig v) => a -> sig v -> sig v Source #

normalize :: (C a, Transform sig a) => (sig a -> a) -> sig a -> sig a Source #

envelope Source #

Arguments

:: (C a, Transform sig a) 
=> sig a

the envelope

-> sig a

the signal to be enveloped

-> sig a 

envelopeVector Source #

Arguments

:: (C a v, Read sig a, Transform sig v) 
=> sig a

the envelope

-> sig v

the signal to be enveloped

-> sig v 

fadeInOut :: (C a, Write sig a) => Int -> Int -> Int -> sig a -> sig a Source #

delay :: (C y, Write sig y) => Int -> sig y -> sig y Source #

delayPad :: Write sig y => y -> Int -> sig y -> sig y Source #

delayPos :: (C y, Write sig y) => Int -> sig y -> sig y Source #

delayNeg :: Transform sig y => Int -> sig y -> sig y Source #

delayLazySize :: (C y, Write sig y) => LazySize -> Int -> sig y -> sig y Source #

delayPadLazySize :: Write sig y => LazySize -> y -> Int -> sig y -> sig y Source #

The pad value y must be defined, otherwise the chunk size of the padding can be observed.

delayPosLazySize :: (C y, Write sig y) => LazySize -> Int -> sig y -> sig y Source #

binomialMask :: (C a, Write sig a) => LazySize -> Int -> sig a Source #

binomial :: (C a, C a, C a v, Transform sig v) => a -> a -> sig v -> sig v Source #

binomial1 :: (C v, Transform sig v) => sig v -> sig v Source #

sums :: (C v, Transform sig v) => Int -> sig v -> sig v Source #

Moving (uniformly weighted) average in the most trivial form. This is very slow and needs about n * length x operations.

sumsDownsample2 :: (C v, Write sig v) => LazySize -> sig v -> sig v Source #

downsample2 :: Write sig v => LazySize -> sig v -> sig v Source #

downsample :: Write sig v => LazySize -> Int -> sig v -> sig v Source #

sumRange :: (C v, Transform sig v) => sig v -> (Int, Int) -> v Source #

pyramid :: (C v, Write sig v) => Int -> sig v -> ([Int], [sig v]) Source #

sumRangeFromPyramid :: (C v, Transform sig v) => [sig v] -> (Int, Int) -> v Source #

sumsPosModulated :: (C v, Transform sig (Int, Int), Transform sig v) => sig (Int, Int) -> sig v -> sig v Source #

sumsPosModulatedPyramid :: (C v, Transform sig (Int, Int), Write sig v) => Int -> sig (Int, Int) -> sig v -> sig v Source #

movingAverageModulatedPyramid :: (C a, C a v, Transform sig Int, Transform sig (Int, Int), Write sig v) => a -> Int -> Int -> sig Int -> sig v -> sig v Source #

The first argument is the amplification. The main reason to introduce it, was to have only a Module constraint instead of Field. This way we can also filter stereo signals.

inverseFrequencyModulationFloor :: (Ord t, C t, Write sig v, Read sig t) => LazySize -> sig t -> sig v -> sig v Source #

differentiate :: (C v, Transform sig v) => sig v -> sig v Source #

Forward difference quotient. Shortens the signal by one. Inverts run in the sense that differentiate (zero : integrate x) == x. The signal is shifted by a half time unit.

differentiateCenter :: (C v, Transform sig v) => sig v -> sig v Source #

Central difference quotient. Shortens the signal by two elements, and shifts the signal by one element. (Which can be fixed by prepending an appropriate value.) For linear functions this will yield essentially the same result as differentiate. You obtain the result of differentiateCenter if you smooth the one of differentiate by averaging pairs of adjacent values.

ToDo: Vector variant

differentiate2 :: (C v, Transform sig v) => sig v -> sig v Source #

Second derivative. It is differentiate2 == differentiate . differentiate but differentiate2 should be faster.

generic :: (C a v, Transform sig a, Write sig v) => sig a -> sig v -> sig v Source #

Unmodulated non-recursive filter (convolution)

Brute force implementation.

karatsubaFinite :: (C a, C b, C c, Transform sig a, Transform sig b, Transform sig c) => (a -> b -> c) -> sig a -> sig b -> sig c Source #

Both should signals should have similar length. If they have considerably different length, then better use karatsubaFiniteInfinite.

Implementation using Karatsuba trick and split-and-overlap-add. This way we stay in a ring, are faster than quadratic runtime but do not reach log-linear runtime.

karatsubaFiniteInfinite :: (C a, C b, C c, Transform sig a, Transform sig b, Transform sig c) => (a -> b -> c) -> sig a -> sig b -> sig c Source #

The first operand must be finite and the second one can be infinite. For efficient operation we expect that the second signal is longer than the first one.

karatsubaInfinite :: (C a, C b, C c, Transform sig a, Transform sig c, Transform sig b) => (a -> b -> c) -> sig a -> sig b -> sig c Source #

type Pair a = (a, a) Source #

convolvePair :: (C a, C b, C c) => (a -> b -> c) -> Pair a -> Pair b -> Triple c Source #

Reasonable choices for the multiplication operation are '(*)', '(*>)', convolve.

sumAndConvolvePair :: (C a, C b, C c) => (a -> b -> c) -> Pair a -> Pair b -> ((a, b), Triple c) Source #

type Triple a = (a, a, a) Source #

convolvePairTriple :: (C a, C b, C c) => (a -> b -> c) -> Pair a -> Triple b -> (c, c, c, c) Source #

convolveTriple :: (C a, C b, C c) => (a -> b -> c) -> Triple a -> Triple b -> (c, c, c, c, c) Source #

sumAndConvolveTriple :: (C a, C b, C c) => (a -> b -> c) -> Triple a -> Triple b -> ((a, b), (c, c, c, c, c)) Source #

sumAndConvolveTripleAlt :: (C a, C b, C c) => (a -> b -> c) -> Triple a -> Triple b -> ((a, b), (c, c, c, c, c)) Source #

type Quadruple a = (a, a, a, a) Source #

convolveQuadruple :: (C a, C b, C c) => (a -> b -> c) -> Quadruple a -> Quadruple b -> (c, c, c, c, c, c, c) Source #

sumAndConvolveQuadruple :: (C a, C b, C c) => (a -> b -> c) -> Quadruple a -> Quadruple b -> ((a, b), (c, c, c, c, c, c, c)) Source #

sumAndConvolveQuadrupleAlt :: (C a, C b, C c) => (a -> b -> c) -> Quadruple a -> Quadruple b -> ((a, b), (c, c, c, c, c, c, c)) Source #

maybeAccumulateRangeFromPyramid :: Transform sig v => (v -> v -> v) -> [sig v] -> (Int, Int) -> Maybe v Source #

accumulatePosModulatedFromPyramid :: (Transform sig (Int, Int), Write sig v) => ([sig v] -> (Int, Int) -> v) -> ([Int], [sig v]) -> sig (Int, Int) -> sig v Source #

Moving average, where window bounds must be always non-negative.

The laziness granularity is 2^height.

withPaddedInput :: (Transform sig Int, Transform sig (Int, Int), Write sig y) => y -> (sig (Int, Int) -> sig y -> v) -> Int -> sig Int -> sig y -> v Source #

addShiftedSimple :: (C a, Transform sig a) => Int -> sig a -> sig a -> sig a Source #

It must hold delay <= length a.

consumeRangeFromPyramid :: Transform sig v => (v -> a -> a) -> a -> [sig v] -> (Int, Int) -> a Source #

sumRangeFromPyramidReverse :: (C v, Transform sig v) => [sig v] -> (Int, Int) -> v Source #

sumRangeFromPyramidFoldr :: (C v, Transform sig v) => [sig v] -> (Int, Int) -> v Source #