synthesizer-llvm-0.2.0.1: Efficient signal processing using runtime compilation

Synthesizer.LLVM.Wave

Synopsis

Documentation

rationalApproxSine1 :: (C a, IsConst a, Replicate a v, Real v, IsFloating v) => Value v -> Value v -> CodeGenFunction r (Value v)Source

For the distortion factor recip pi you get the closest approximation to an undistorted cosine or sine. We have chosen this scaling in order to stay with field operations.

replicate :: (C a, IsConst a, Replicate a v, Fraction v, Real v) => Value v -> Value v -> CodeGenFunction r (Value v)Source

This can be used for preprocessing the phase in order to generate locally faster oscillating waves. For example

 triangle <=< replicate (valueOf 2.5)

shrinks a triangle wave such that 2.5 periods fit into one.

halfEnvelope :: (C a, IsConst a, Replicate a v, Fraction v, Real v) => Value v -> CodeGenFunction r (Value v)Source

Preprocess the phase such that the first half of a wave is expanded to one period and shifted by 90 degree. E.g.

 sine <=< halfEnvelope

generates a sequence of sine bows that starts and ends with the maximum. Such a signal can be used to envelope an oscillation generated using replicate.