Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Interpolation buffers.
Synopsis
- linear :: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Num s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) => v -> v -> ResamplingBuffer m cl1 cl2 v v
- sinc :: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Ord s, Floating s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) => s -> ResamplingBuffer m cl1 cl2 v v
- cubic :: (Monad m, VectorSpace v s, Floating v, Eq v, Fractional s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) => ResamplingBuffer m cl1 cl2 v v
Documentation
:: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Num s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) | |
=> v | The initial velocity (derivative of the signal) |
-> v | The initial position |
-> ResamplingBuffer m cl1 cl2 v v |
A simple linear interpolation based on the last calculated position and velocity.
:: (Monad m, Clock m cl1, Clock m cl2, VectorSpace v s, Ord s, Floating s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) | |
=> s | The size of the interpolation window (for how long in the past to remember incoming values) |
-> ResamplingBuffer m cl1 cl2 v v |
sinc-Interpolation, or Whittaker-Shannon-Interpolation.
The incoming signal is strictly bandlimited
by the frequency at which cl1
ticks.
Each incoming value is hulled in a sinc function,
these are added and sampled at cl2
's ticks.
In order not to produce a space leak,
the buffer only remembers the past values within a given window,
which should be chosen much larger than the average time between cl1
's ticks.
cubic :: (Monad m, VectorSpace v s, Floating v, Eq v, Fractional s, s ~ Diff (Time cl1), s ~ Diff (Time cl2)) => ResamplingBuffer m cl1 cl2 v v Source #
Interpolates the signal with Hermite splines,
using threePointDerivative
.
Caution: In order to calculate the derivatives of the incoming signal,
it has to be delayed by two ticks of cl1
.
In a non-realtime situation, a higher quality is achieved
if the ticks of cl2
are delayed by two ticks of cl1
.