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

Safe HaskellNone
LanguageHaskell2010

Synthesizer.Dimensional.Map

Description

Maps that handle pairs of amplitudes and sampled values. They are a special form of arrows.

Synopsis

Documentation

type T = T (->) Source #

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.

type Single amp0 amp1 yv0 yv1 = Single (->) amp0 amp1 yv0 yv1 Source #

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 #

forcePrimitiveAmplitude :: (Primitive amp, Arrow arrow) => Single arrow amp amp 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!

id :: Category arrow => T arrow sample sample Source #

double :: Arrow arrow => T arrow sample (sample, sample) Source #

fst :: Arrow arrow => T arrow (sample0, sample1) sample0 Source #

snd :: Arrow arrow => T arrow (sample0, sample1) sample1 Source #

swap :: Arrow arrow => T arrow (sample0, sample1) (sample1, sample0) Source #

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 #