synthesizer-dimensional-0.5: Audio signal processing with static physical dimensions

Synthesizer.Dimensional.Signal.Private

Contents

Description

Signals equipped with volume and sample rate information that may carry a unit. Kind of volume and sample rate is configurable by types.

Synopsis

Documentation

data T rate amplitude body Source

A signal value 0.5 at global amplitude 1 and signal value 1 at global amplitude 0.5 shall represent the same signal. Thus it is unsafe to observe the amplitude.

ToDo: Maybe we should support zipped signals with mixed amplitudes, e.g. T rate (amp0, amp1) (Sig.T (y0,y1)) in order to be compliant with the way Causal and Wave.Controlled handle multiple sources. However, this is dangerous, since T rate amp (Sig.T (y0,y1)) might be used for stereo signals. Of course, for stereo signals Stereo.T should be prefered.

Cyclic nature such as needed for Fourier transform must be expressend in the body. It would be nice to use the data type for waveforms, too, but for waveforms the rate parameter makes no sense.

Constructors

Cons 

Fields

sampleRate :: rate
 
amplitude :: amplitude
 
body :: body
 

type R s v y yv = T (Phantom s) (Dimensional v y) (T yv)Source

actualSampleRate :: T (Actual rate) amp sig -> rateSource

actualAmplitude :: T rate (Numeric amp) sig -> ampSource

toAmplitudeScalar :: (C y, C v) => T rate (Dimensional v y) sig -> T v y -> ySource

rewriteAmplitudeDimension :: (C v0, C v1) => (v0 -> v1) -> T rate (Dimensional v0 y) sig -> T rate (Dimensional v1 y) sigSource

asTypeOfAmplitude :: y -> T rate (Dimensional v y) sig -> ySource

scalarSamples :: (C y, Transform sig y) => (amp -> y) -> T rate (Numeric amp) (sig y) -> sig ySource

vectorSamples :: (C y yv, Transform sig yv) => (amp -> y) -> T rate (Numeric amp) (sig yv) -> sig yvSource

embedSampleRate :: C u => T s u t (T (Phantom s) amp sig -> T (Dimensional u t) amp sig)Source

render :: C u => T (Recip u) t -> (forall s. T s u t (T (Phantom s) amp sig)) -> T (Dimensional u t) amp sigSource

processBody :: (sig0 -> sig1) -> T rate amp sig0 -> T rate amp sig1Source

replaceBody :: sig1 -> T rate amp sig0 -> T rate amp sig1Source

fromBody :: amp -> sig -> T (Phantom s) (Numeric amp) sigSource

flatFromBody :: sig -> T (Phantom s) (Flat y) sigSource

primitiveFromBody :: Primitive amp => sig -> T (Phantom s) amp sigSource

caching

cache :: Storable yv => T rate amp (T yv) -> T rate amp (T yv)Source

bindCached :: Storable yv => T s u t (T rate amp (T yv)) -> (T rate amp (T yv) -> T s u t b) -> T s u t bSource

share :: Storable yv => T s u t (T rate amp (T yv)) -> (T s u t (T rate amp (T yv)) -> T s u t b) -> T s u t bSource

store :: (C t, C u, Storable yv) => T u t -> T s u t (T (Phantom s) amp (T yv) -> T (Phantom s) amp (T yv))Source

restore :: Read sig yv => T rate amp (sig yv) -> T rate amp (T yv)Source

toStorableInt16Stereo :: (C a a, C a) => T rate (Dimensional Voltage a) (T (T a)) -> T (T Int16)Source