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



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



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 Causal.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 yv1Source

consFlip :: (Amplitude sample0 -> (Amplitude sample1, Displacement sample0 -> Displacement sample1)) -> T sample0 sample1Source

apply :: Transform sig yv0 yv1 => Single amp0 amp1 yv0 yv1 -> T rate amp0 (sig yv0) -> T rate amp1 (sig yv1)Source

applyFlat :: (C yv0 amp0, Transform sig yv0 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 yvSource

forcePrimitiveAmplitude :: (Primitive amp, Arrow arrow) => Single arrow amp amp yv yvSource

mapAmplitude :: (C amp0, C amp1, Arrow arrow) => (amp0 -> amp1) -> Single arrow amp0 amp1 yv yvSource

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: Using this function is however still unsafe, 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 is also unsafe. This may only be used for proportional mappings. See T.

mapAmplitudeSameType :: Arrow arrow => (Amplitude sample -> Amplitude sample) -> T arrow sample sampleSource

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 sample1Source

This function can be abused to bring the amplitudes out of order. So be careful!

id :: Category arrow => T arrow sample sampleSource

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

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

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

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