Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|

Signal analysis.

- diff :: forall a m. (Eq a, Monad m) => Wire m a (Event (a, Time))
- avg :: forall m v. (Fractional v, Monad m, NFData v, Unbox v) => Int -> Wire m v v
- avgAll :: forall m v. (Fractional v, Monad m, NFData v) => Wire m v v
- avgFps :: forall a m. Monad m => Int -> Wire m a Double
- highPeak :: (Monad m, NFData a, Ord a) => Wire m a a
- lowPeak :: (Monad m, NFData a, Ord a) => Wire m a a
- peakBy :: forall a m. (Monad m, NFData a) => (a -> a -> Ordering) -> Wire m a a

# Changes

diff :: forall a m. (Eq a, Monad m) => Wire m a (Event (a, Time))Source

Emits an event, whenever the input signal changes. The event contains the last input value and the time elapsed since the last change.

# Statistics

## Average

avg :: forall m v. (Fractional v, Monad m, NFData v, Unbox v) => Int -> Wire m v vSource

Calculate the average of the signal over the given number of last samples. This wire has O(n) space complexity and O(1) time complexity.

If you need an average over all samples ever produced, consider using
`avgAll`

instead.

avgAll :: forall m v. (Fractional v, Monad m, NFData v) => Wire m v vSource

Calculate the average of the signal over all samples.

Please note that somewhat surprisingly this wire runs in constant
space and is generally faster than `avg`

, but most applications will
benefit from averages over only the last few samples.

avgFps :: forall a m. Monad m => Int -> Wire m a DoubleSource

Calculate the average number of frames per virtual second for the last given number of frames.

Please note that this wire uses the clock, which you give the network using the stepping functions in FRP.NetWire.Session. If this clock doesn't represent real time, then the output of this wire won't either.