Several functions that add a loop to a sampled sound. This way you can obtain an infinite sound that consumes only finite space.
- 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
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.
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.
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.