synthesizer-0.0.3: Audio signal processing coded in HaskellSource codeContentsIndex
Synthesizer.Plain.Interpolation
Contents
Interpolation with various padding methods
Interpolation of multiple values with various padding methods
Interpolation of multiple values with various padding methods
All-in-one interpolation functions
Different kinds of interpolation
Hard-wired interpolations
Interpolation based on piecewise defined functions
Interpolation based on arbitrary functions
Helper functions
Description
ToDo: use AffineSpace instead of Module for the particular interpolation types, since affine combinations assert reconstruction of constant functions. They are more natural for interpolation of internal control parameters. However, how can cubic interpolation expressed by affine combinations without divisions?
Synopsis
data T t y = Cons {
number :: Int
offset :: Int
func :: t -> T y -> y
}
zeroPad :: C t => (T t y -> t -> T y -> a) -> y -> T t y -> t -> T y -> a
constantPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
cyclicPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
extrapolationPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
skip :: C t => T t y -> (t, T y) -> (t, T y)
single :: C t => T t y -> t -> T y -> y
singleRec :: (Ord t, C t) => T t y -> t -> T y -> y
multiRelative :: C t => T t y -> t -> T y -> T t -> T y
multiRelativeZeroPad :: C t => y -> T t y -> t -> T t -> T y -> T y
multiRelativeConstantPad :: C t => T t y -> t -> T t -> T y -> T y
multiRelativeCyclicPad :: C t => T t y -> t -> T t -> T y -> T y
multiRelativeExtrapolationPad :: C t => T t y -> t -> T t -> T y -> T y
multiRelativeZeroPadConstant :: (C t, C y) => t -> T t -> T y -> T y
multiRelativeZeroPadLinear :: (C t, C t y) => t -> T t -> T y -> T y
multiRelativeZeroPadCubic :: (C t, C t y) => t -> T t -> T y -> T y
data PrefixReader y a = PrefixReader Int (StateT (T y) Maybe a)
getNode :: PrefixReader y y
fromPrefixReader :: String -> Int -> PrefixReader y (t -> y) -> T t y
constant :: T t y
linear :: C t y => T t y
cubic :: (C t, C t y) => T t y
cubicAlt :: (C t, C t y) => T t y
cubicHalf :: C t y => t -> y -> y -> y
piecewise :: C t y => Int -> [t -> t] -> T t y
piecewiseConstant :: C t y => T t y
piecewiseLinear :: C t y => T t y
piecewiseCubic :: (C t, C t y) => T t y
function :: C t y => (Int, Int) -> (t -> t) -> T t y
minLength :: Int -> T y -> Bool
Documentation
data T t y Source
interpolation as needed for resampling
Constructors
Cons
number :: Int
offset :: Int
func :: t -> T y -> y
Interpolation with various padding methods
zeroPad :: C t => (T t y -> t -> T y -> a) -> y -> T t y -> t -> T y -> aSource
constantPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> aSource
cyclicPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> aSource
Only for finite input signals.
extrapolationPad :: C t => (T t y -> t -> T y -> a) -> T t y -> t -> T y -> aSource
The extrapolation may miss some of the first and some of the last points
Interpolation of multiple values with various padding methods
skip :: C t => T t y -> (t, T y) -> (t, T y)Source
single :: C t => T t y -> t -> T y -> ySource
singleRec :: (Ord t, C t) => T t y -> t -> T y -> ySource
alternative implementation of single
Interpolation of multiple values with various padding methods
multiRelative :: C t => T t y -> t -> T y -> T t -> T ySource
All values of frequency control must be non-negative.
multiRelativeZeroPad :: C t => y -> T t y -> t -> T t -> T y -> T ySource
multiRelativeConstantPad :: C t => T t y -> t -> T t -> T y -> T ySource
multiRelativeCyclicPad :: C t => T t y -> t -> T t -> T y -> T ySource
multiRelativeExtrapolationPad :: C t => T t y -> t -> T t -> T y -> T ySource
The extrapolation may miss some of the first and some of the last points
All-in-one interpolation functions
multiRelativeZeroPadConstant :: (C t, C y) => t -> T t -> T y -> T ySource
multiRelativeZeroPadLinear :: (C t, C t y) => t -> T t -> T y -> T ySource
multiRelativeZeroPadCubic :: (C t, C t y) => t -> T t -> T y -> T ySource
Different kinds of interpolation
Hard-wired interpolations
data PrefixReader y a Source
Constructors
PrefixReader Int (StateT (T y) Maybe a)
show/hide Instances
getNode :: PrefixReader y ySource
fromPrefixReader :: String -> Int -> PrefixReader y (t -> y) -> T t ySource
constant :: T t ySource
Consider the signal to be piecewise constant.
linear :: C t y => T t ySource
Consider the signal to be piecewise linear.
cubic :: (C t, C t y) => T t ySource
Consider the signal to be piecewise cubic, with smooth connections at the nodes. It uses a cubic curve which has node values x0 at 0 and x1 at 1 and derivatives (x1-xm1)2 and (x2-x0)2, respectively. You can see how it works if you evaluate the expression for t=0 and t=1 as well as the derivative at these points.
cubicAlt :: (C t, C t y) => T t ySource
cubicHalf :: C t y => t -> y -> y -> ySource
Interpolation based on piecewise defined functions
piecewise :: C t y => Int -> [t -> t] -> T t ySource
piecewiseConstant :: C t y => T t ySource
piecewiseLinear :: C t y => T t ySource
piecewiseCubic :: (C t, C t y) => T t ySource
Interpolation based on arbitrary functions
functionSource
:: C t y
=> (Int, Int)(left extent, right extent), e.g. (1,1) for linear hat
-> t -> t
-> T t y
with this wrapper you can use the collection of interpolating functions from Donadio's DSP library
Helper functions
minLength :: Int -> T y -> BoolSource
Test if a list has at least n elements make sure that n is non-negative
Produced by Haddock version 2.3.0