Safe Haskell | None |
---|---|
Language | Haskell2010 |
Maps that handle pairs of amplitudes and sampled values. They are a special form of arrows.
- type T = T (->)
- type Single amp0 amp1 yv0 yv1 = Single (->) amp0 amp1 yv0 yv1
- consFlip :: (Amplitude sample0 -> (Amplitude sample1, Displacement sample0 -> Displacement sample1)) -> T sample0 sample1
- apply :: (Transform sig yv0, Transform sig yv1) => Single amp0 amp1 yv0 yv1 -> T rate amp0 (sig yv0) -> T rate amp1 (sig yv1)
- applyFlat :: (C yv0 amp0, Transform sig yv0, Transform sig yv1) => Single (Flat yv0) amp1 yv0 yv1 -> T rate amp0 (sig yv0) -> T rate amp1 (sig yv1)
- forceDimensionalAmplitude :: (C v, C y, C y yv, Arrow arrow) => T v y -> Single arrow (Dimensional v y) (Dimensional v y) yv yv
- forcePrimitiveAmplitude :: (Primitive amp, Arrow arrow) => Single arrow amp amp yv yv
- mapAmplitude :: (C amp0, C amp1, Arrow arrow) => (amp0 -> amp1) -> Single arrow amp0 amp1 yv yv
- mapAmplitudeSameType :: Arrow arrow => (Amplitude sample -> Amplitude sample) -> T arrow sample sample
- independent :: Arrow arrow => (Amplitude sample0 -> Amplitude sample1) -> (Displacement sample0 -> Displacement sample1) -> T arrow sample0 sample1
- id :: Category arrow => T arrow sample sample
- double :: Arrow arrow => T arrow sample (sample, sample)
- fst :: Arrow arrow => T arrow (sample0, sample1) sample0
- snd :: Arrow arrow => T arrow (sample0, sample1) sample1
- swap :: Arrow arrow => T arrow (sample0, sample1) (sample1, sample0)
- balanceRight :: Arrow arrow => T arrow ((sample0, sample1), sample2) (sample0, (sample1, sample2))
- balanceLeft :: Arrow arrow => T arrow (sample0, (sample1, sample2)) ((sample0, sample1), sample2)
- packTriple :: Arrow arrow => T arrow (sample0, (sample1, sample2)) (sample0, sample1, sample2)
- unpackTriple :: Arrow arrow => T arrow (sample0, sample1, sample2) (sample0, (sample1, sample2))
Documentation
This type shall ensure, that you do not accidentally
bring amplitudes and the corresponding low-level signal values out of sync.
We also use it for generation of internal control parameters
in Synthesizer.Dimensional.Causal.ControlledProcess.
In principle this could also be T
,
but maps are not bound to a sampling rate,
and thus do not need the s
type parameter.
consFlip :: (Amplitude sample0 -> (Amplitude sample1, Displacement sample0 -> Displacement sample1)) -> T sample0 sample1 Source #
apply :: (Transform sig yv0, Transform sig yv1) => Single amp0 amp1 yv0 yv1 -> T rate amp0 (sig yv0) -> T rate amp1 (sig yv1) Source #
applyFlat :: (C yv0 amp0, Transform sig yv0, Transform sig yv1) => Single (Flat yv0) amp1 yv0 yv1 -> T rate amp0 (sig yv0) -> T rate amp1 (sig yv1) Source #
forceDimensionalAmplitude :: (C v, C y, C y yv, Arrow arrow) => T v y -> Single arrow (Dimensional v y) (Dimensional v y) yv yv Source #
mapAmplitude :: (C amp0, C amp1, Arrow arrow) => (amp0 -> amp1) -> Single arrow amp0 amp1 yv yv Source #
We restrict the amplitude types to those of class Amplitude
.
Otherwise mapAmplitude
could be abused
for bringing amplitudes and respective sample values out of sync.
For mapping amplitudes that are nested in some pairs,
use it in combination with first
and second
.
FIXME:
This function however still breaks the abstraction,
since normally it should not be observable
how the volume is balanced between amplitude and signal.
This function allows to replace an actual amplitude by Flat
,
which also breaks the abstraction.
This may only be used for proportional mappings.
See T
.
mapAmplitudeSameType :: Arrow arrow => (Amplitude sample -> Amplitude sample) -> T arrow sample sample Source #
FIXME: This function is unsafe.
Only use it for proportional mappings.
See T
.
independent :: Arrow arrow => (Amplitude sample0 -> Amplitude sample1) -> (Displacement sample0 -> Displacement sample1) -> T arrow sample0 sample1 Source #
This function can be abused to bring the amplitudes out of order. So be careful!
balanceRight :: Arrow arrow => T arrow ((sample0, sample1), sample2) (sample0, (sample1, sample2)) Source #
balanceLeft :: Arrow arrow => T arrow (sample0, (sample1, sample2)) ((sample0, sample1), sample2) Source #
packTriple :: Arrow arrow => T arrow (sample0, (sample1, sample2)) (sample0, sample1, sample2) Source #
unpackTriple :: Arrow arrow => T arrow (sample0, sample1, sample2) (sample0, (sample1, sample2)) Source #