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

Synthesizer.LLVM.Wave

Synopsis

# Documentation

triangleSquarePower :: (PseudoRing a, RationalConstant a, Real a) => Integer -> a -> CodeGenFunction r aSource

Discrete interpolation between triangle and square wave. For exponent 1 we get a triangle wave. The larger the exponent, the more we approach a square wave, the.more computing is necessary.

triangleSquareRatio :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r aSource

Continuous interpolation between triangle and square wave. For factor 0 we get a square wave, for factor 1 we get a triangle wave.

rationalApproxCosine1 :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r aSource

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.

rationalApproxSine1 :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r aSource

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 :: (PseudoRing a, RationalConstant a, Fraction a) => a -> a -> CodeGenFunction r aSource

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 :: (PseudoRing a, RationalConstant a, Fraction a) => a -> CodeGenFunction r aSource

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`.