Signals equipped with volume and sample rate information that may carry a unit. Kind of volume and sample rate is configurable by types.
- data T rate amplitude body = Cons {
- sampleRate :: rate
- amplitude :: amplitude
- body :: body
- type R s v y yv = T (Phantom s) (Dimensional v y) (T yv)
- actualSampleRate :: T (Actual rate) amp sig -> rate
- actualAmplitude :: T rate (Numeric amp) sig -> amp
- toAmplitudeScalar :: (C y, C v) => T rate (Dimensional v y) sig -> T v y -> y
- rewriteAmplitudeDimension :: (C v0, C v1) => (v0 -> v1) -> T rate (Dimensional v0 y) sig -> T rate (Dimensional v1 y) sig
- asTypeOfAmplitude :: y -> T rate (Dimensional v y) sig -> y
- scalarSamples :: (C y, Transform sig y) => (amp -> y) -> T rate (Numeric amp) (sig y) -> sig y
- vectorSamples :: (C y yv, Transform sig yv) => (amp -> y) -> T rate (Numeric amp) (sig yv) -> sig yv
- embedSampleRate :: C u => T s u t (T (Phantom s) amp sig -> T (Dimensional u t) amp sig)
- render :: C u => T (Recip u) t -> (forall s. T s u t (T (Phantom s) amp sig)) -> T (Dimensional u t) amp sig
- processBody :: (sig0 -> sig1) -> T rate amp sig0 -> T rate amp sig1
- replaceBody :: sig1 -> T rate amp sig0 -> T rate amp sig1
- fromBody :: amp -> sig -> T (Phantom s) (Numeric amp) sig
- flatFromBody :: sig -> T (Phantom s) (Flat y) sig
- abstractFromBody :: sig -> T (Phantom s) Abstract sig
- primitiveFromBody :: Primitive amp => sig -> T (Phantom s) amp sig
- cache :: Storable yv => T rate amp (T yv) -> T rate amp (T yv)
- 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 b
- 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 b
- 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))
- restore :: Read sig yv => T rate amp (sig yv) -> T rate amp (T yv)
- toStorableInt16Mono :: C a => T rate (Dimensional Voltage a) (T a) -> T Int16
- toStorableInt16Stereo :: (C a a, C a) => T rate (Dimensional Voltage a) (T (T a)) -> T (T Int16)
- defaultChunkSize :: ChunkSize
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.
Cons | |
|
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
flatFromBody :: sig -> T (Phantom s) (Flat y) sigSource
abstractFromBody :: sig -> T (Phantom s) Abstract sigSource
primitiveFromBody :: Primitive amp => sig -> T (Phantom s) amp sigSource
caching
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
toStorableInt16Mono :: C a => T rate (Dimensional Voltage a) (T a) -> T Int16Source