Safe Haskell | None |
---|---|

Language | Haskell2010 |

Several functions that add a loop to a sampled sound. This way you can obtain an infinite sound that consumes only finite space.

## Synopsis

- simple :: Transform sig => Int -> Int -> sig -> sig
- fade :: (Transform sig yv, C y, C y yv) => y -> Int -> Int -> sig yv -> sig yv
- timeReverse :: (Write sig yv, C q, C q yv) => LazySize -> T q yv -> T q yv -> TimeControl q -> q -> q -> (q, sig yv) -> (q, sig yv)
- data TimeControl a
- timeControlSine :: C a => TimeControl a
- timeControlZigZag :: C a => TimeControl a

# Documentation

simple :: Transform sig => Int -> Int -> sig -> sig Source #

Most simple of looping: You give start and length of the loop body and this part is repeated. The data behind start+length is ignored.

fade :: (Transform sig yv, C y, C y yv) => y -> Int -> Int -> sig yv -> sig yv Source #

Create a smooth loop by cross-fading a part with delayed versions of itself. The loop length will be rounded to the next smaller even number.

timeReverse :: (Write sig yv, C q, C q yv) => LazySize -> T q yv -> T q yv -> TimeControl q -> q -> q -> (q, sig yv) -> (q, sig yv) Source #

Resample a sampled sound with a smooth loop using our time manipulation algorithm. Time is first controlled linearly, then switches to a sine or triangular control. Loop start must be large enough in order provide enough spare data for interpolation at the beginning and loop start plus length must preserve according space at the end. One period is enough space for linear interpolation.

In order to get a loopable sound with finite space we have to reduce the loop length to a multiple of a wave period. We will also modify the period a little bit, such that in our loop body there is an integral number of periods.

We return the modified period and the looped sound.

data TimeControl a Source #

timeControlSine :: C a => TimeControl a Source #

timeControlZigZag :: C a => TimeControl a Source #