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

Safe HaskellNone

Synthesizer.Generic.Cut

Description

This module allows abstraction of operations that operate on the time axis and do also work on signal types without sample values. The most distinctive instances are certainly Dirac signals and chunky time values.

Synopsis

Documentation

class Read sig where

Methods

null :: sig -> Bool

length :: sig -> Int

Instances

Read LazySize 
Read [y] 
Integral a => Read (T a) 
(C a, C a) => Read (T a) 
Storable y => Read (Vector y) 
Storable y => Read (Vector y) 
Read (T y) 
Read (Chunk a) 
Integral t => Read (T t y) 
Integral t => Read (T t y)

We abuse event lists for efficient representation of piecewise constant signals.

(Read a, Read b) => Read (T a b) 

class Read sig => NormalForm sig where

Methods

evaluateHead :: sig -> ()

Evaluating the first value of the signal is necessary for avoiding a space leaks if you repeatedly drop a prefix from the signal and do not consume something from it.

Instances

NFData y => NormalForm [y] 
(Integral a, C a, NFData a) => NormalForm (T a) 
(C a, C a, NFData a) => NormalForm (T a) 
Storable y => NormalForm (Vector y) 
Storable y => NormalForm (Vector y) 
NFData y => NormalForm (T y) 
NormalForm (Chunk a) 
(Integral t, NFData y) => NormalForm (T t y) 
(NormalForm a, NormalForm b) => NormalForm (T a b) 

class (Read sig, Monoid sig) => Transform sig where

Methods

take :: Int -> sig -> sig

drop :: Int -> sig -> sig

dropMarginRem :: Int -> Int -> sig -> (Int, sig)

splitAt :: Int -> sig -> (sig, sig)

reverse :: sig -> sig

Instances

Transform LazySize 
Transform [y] 
(Integral a, C a) => Transform (T a) 
(C a, C a) => Transform (T a) 
Storable y => Transform (Vector y) 
Storable y => Transform (Vector y) 
Transform (T y) 
Transform (Chunk a) 
(Integral t, C t) => Transform (T t y) 
(Integral t, C t) => Transform (T t y)

The function defined here are based on the interpretation of event lists as piecewise constant signals. They do not fit to the interpretation of atomic events. Because e.g. it makes no sense to split an atomic event into two instances by splitAt, and it is also not clear, whether dropping the first chunk shall leave a chunk of length zero or remove that chunk completely.

However, sometimes we also need lists of events. In this case the reverse method would be different. For an event-oriented instance of EventList.TimeTime see NoteOffList in synthesizer-alsa package.

(Transform a, Transform b) => Transform (T a b) 

dropMarginRemChunky :: Transform sig => (sig -> [Int]) -> Int -> Int -> sig -> (Int, sig)

intToChunky :: (C a, C a) => String -> Int -> T a

intToChunky98 :: (Num a, C a) => String -> Int -> T a

empty :: Monoid sig => sig

cycle :: Monoid sig => sig -> sig

append :: Monoid sig => sig -> sig -> sig

concat :: Monoid sig => [sig] -> sig

lengthAtLeast :: Transform sig => Int -> sig -> Bool

Like lengthAtLeast n xs = length xs >= n, but is more efficient, because it is more lazy.

lengthAtMost :: Transform sig => Int -> sig -> Bool

sliceVertical :: Transform sig => Int -> sig -> T sig