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

Safe HaskellNone

Synthesizer.CausalIO.Process

Description

Process chunks of data in the IO monad. Typical inputs are strict storable vectors and piecewise constant values, and typical outputs are strict storable vectors. You may also combine several of these types using the Zip type constructor.

We may substitute IO by ST in the future, but I am uncertain about that. On the one hand, the admissible IO functionality is very restricted, only memory manipulation is allowed, on the other hand we use ForeignPtrs that are not part of ST framework.

Synopsis

Documentation

data T a b

Constructors

forall state . Cons (a -> state -> IO (b, state)) (IO state) (state -> IO ()) 

Instances

Arrow T 
Category T 
(Transform a, Read b, Monoid b) => Monoid (T a b)

mappend should be used sparingly. In a loop it will have to construct types at runtime which is rather expensive.

fromCausal :: Monoid b => T a b -> T a b

mapAccum :: (a -> state -> (b, state)) -> state -> T a b

traverse :: state -> (a -> State state b) -> T a b

runCont :: (Transform a, Transform b) => T a b -> IO (([a] -> [b]) -> [a] -> [b])

This function converts a process into a function on lazy storable vectors. To this end it must call unsafePerformIO, that is, the effects of all functions called in the process must not be observable.

I am not sure, we need this function at all.

runStorableChunkyCont :: (Storable a, Storable b) => T (Vector a) (Vector b) -> IO ((Vector a -> Vector b) -> Vector a -> Vector b)

The same restrictions as for runCont apply.

zip :: Arrow arrow => arrow a b -> arrow a c -> arrow a (T b c)

continue :: (Transform a, Transform sig b) => T a (sig b) -> (b -> T a (sig b)) -> T a (sig b)

If the first process does not produce any output, then the continuing process will not be started.

continueChunk :: (Transform a, Transform b) => T a b -> (b -> T a b) -> T a b

Pass the last non-empty output chunk as parameter to the continuing process. This breaks the abstraction from the chunk sizes, but we need it for implementing vectorized processing.